def get_cluster(scope: Construct, vpc: Vpc) -> Cluster:
    config = get_cluster_config()
    stack_name = config.stack_name
    return Cluster.from_cluster_attributes(
        scope,
        'cluster',
        cluster_name=Fn.import_value(stack_name + 'ClusterName'),
        vpc=vpc,
        has_ec2_capacity=False,
        security_groups=[],
    )
def get_vpc(scope: Construct) -> Vpc:
    config = get_cluster_config()
    stack_name = config.stack_name
    return Vpc.from_vpc_attributes(
        scope,
        'vpc',
        vpc_id=Fn.import_value(stack_name + 'VpcId'),
        vpc_cidr_block=Fn.import_value(stack_name + 'VpcCidrBlock'),
        availability_zones=[
            Fn.import_value(stack_name + 'AvailabilityZone0'),
            Fn.import_value(stack_name + 'AvailabilityZone1'),
        ],
        public_subnet_ids=[
            Fn.import_value(stack_name + 'PublicSubnetId0'),
            Fn.import_value(stack_name + 'PublicSubnetId1'),
        ],
        isolated_subnet_ids=[
            Fn.import_value(stack_name + 'IsolatedSubnet0'),
            Fn.import_value(stack_name + 'IsolatedSubnet1'),
        ],
    )
Exemplo n.º 3
0
 def __init__(self, stack: core.Stack):
     self._config = get_container_config()
     self._cluster_config = get_cluster_config()
     self._name = self._config.stack_name
     self._stack = stack
Exemplo n.º 4
0
#!/usr/bin/env python3

from aws_cdk import core

from obm_cluster.config import get_cluster_config
from obm_container.config import get_container_config
from obm_volume.config import get_volume_config
from obm_cluster.stack import ObmClusterStack
from obm_volume.stack import ObmVolumeStack
from obm_container.stack import ObmContainerStack

cluster_config = get_cluster_config()
volume_config = get_volume_config()
container_config = get_container_config()

app = core.App()
cluster = ObmClusterStack(app, cluster_config.stack_name)
volume = ObmVolumeStack(app, volume_config.stack_name)
volume.add_dependency(cluster)
container = ObmContainerStack(app, container_config.stack_name)
container.add_dependency(volume)

app.synth()