def cdk_init(stack_name: str, force_spot_price: bool): config = configure(stack_name) tags = config.get('tags') vpc_stack = VpcStack(app, f"{stack_name}-vpc", cidr=config['cidr'], env=core.Environment(region=config['region'], )) asg_stack = AsgStack(app, f"{stack_name}-asg", stack_name=stack_name, region=config['region'], vpc=vpc_stack.vpc, ec2_instance_type=config['ec2_instance_type'], ami_id=config['ami_id'], ssh_key=config['ssh_key'], max_spot_price=config['max_spot_price'], ssh_allow_ip_range=config['ssh_allow_ip_range'], asg_size=config['asg_size'], force_spot_price=force_spot_price, env=core.Environment(region=config['region'])) for tag in tags: core.Tag.add(asg_stack, tag.get('name'), tag.get('value')) core.Tag.add(vpc_stack, tag.get('name'), tag.get('value')) app.synth()
def __init__(self, scope: core.Construct, id: str, **kwargs) -> None: super().__init__(scope, id, **kwargs) source_artifact = codepipeline.Artifact() cloud_assembly_artifact = codepipeline.Artifact() # Install_command - installs CDK pipeline = pipelines.CdkPipeline( self, 'Pipeline', cloud_assembly_artifact=cloud_assembly_artifact, pipeline_name='Webinar_Pipeline', source_action=cpactions.GitHubSourceAction( action_name='GitHub', output=source_artifact, oauth_token=core.SecretValue.secrets_manager('github-token'), owner='kevinggrimm', repo='aws-cdk-pipeline', trigger=cpactions.GitHubTrigger.POLL), synth_action=pipelines.SimpleSynthAction( source_artifact=source_artifact, cloud_assembly_artifact=cloud_assembly_artifact, install_command= 'npm install -g aws-cdk && pip install -r requirements.txt', build_command='pytest unittests', synth_command='cdk synth')) # Can be a different account and region # Easy ability to deploy to different regions, accounts pre_prod_app = WebServiceStage(self, 'Pre-prod', env=core.Environment( account="893961191302", region="us-west-1")) pre_prod_stage = pipeline.add_application_stage(pre_prod_app) # use_outputs - give env var to fill; ask pipeline for stack output represented by URL pre_prod_stage.add_actions( pipelines.ShellScriptAction( action_name='Integ', run_order=pre_prod_stage.next_sequential_run_order(), additional_artifacts=[source_artifact], commands=[ 'pip install -r requirements.txt', 'pytest integtests', ], # Output represented by URL output # Can create identifiable outputs for usage in pipeline use_outputs={ 'SERVICE_URL': pipeline.stack_output(pre_prod_app.url_output) })) pipeline.add_application_stage( WebServiceStage(self, 'Prod', env=core.Environment(account="893961191302", region="us-west-1")))
def __init__(self, scope: core.Construct, id: str, *, env=None): super().__init__(scope, id, env=env) source_artifact = aws_codepipeline.Artifact() cloud_assembly_artifact = aws_codepipeline.Artifact() source_action = aws_codepipeline_actions.GitHubSourceAction( action_name="GitHub", output=source_artifact, oauth_token=core.SecretValue.secrets_manager("github-token"), # Replace these with your actual GitHub project name owner="winderslide008", repo="prj-cdk_python") synth_action = pipelines.SimpleSynthAction.standard_npm_synth( source_artifact=source_artifact, cloud_assembly_artifact=cloud_assembly_artifact, install_command= "npm install -g aws-cdk && npm update && python -m pip install -r requirements.txt", # Use this if you need a build step (if you're not using ts-node # or if you have TypeScript Lambdas that need to be compiled). build_command="npx cdk synth -o dist") cdk_props = pipelines.CdkPipelineProps( synth_action=synth_action, source_action=source_action, cloud_assembly_artifact=cloud_assembly_artifact, pipeline_name="cdkPythonPipeline") # pipeline = pipelines.CdkPipeline(self, "pipe", cdk_props=cdk_props) pipeline = pipelines.CdkPipeline( self, "pipelineCdkPython", synth_action=synth_action, source_action=source_action, cloud_assembly_artifact=cloud_assembly_artifact) pprod_env = core.Environment(account="927534600513", region="eu-central-1") # pprod_props = core.StageProps(env=pprod_env) pipeline_stage_pprod = PipelineStage(self, id="preprod", env=pprod_env) pipeline.add_application_stage(pipeline_stage_pprod) prod_env = core.Environment(account="582362266023", region="eu-central-1") pipeline_stage_prod = PipelineStage(self, id="prod", env=prod_env) pipeline.add_application_stage(pipeline_stage_prod)
def __init__(self, **kwargs) -> None: super().__init__(**kwargs) self.env=core.Environment( account='234873931226', region='eu-central-1' )
def main(): app = core.App() with open(app.node.try_get_context("config") or "config.yaml") as f: cfg = config_loader(yaml_load(f, Loader=SafeLoader)) nest = app.node.try_get_context("nest") or False DominoStack( app, f"{cfg.name}-eks-stack", # If you don't specify 'env', this stack will be environment-agnostic. # Account/Region-dependent features and context lookups will not work, # but a single synthesized template can be deployed anywhere. # Uncomment the next line to specialize this stack for the AWS Account # and Region that are implied by the current CLI configuration. # env=core.Environment(account=os.getenv('CDK_DEFAULT_ACCOUNT'), region=os.getenv('CDK_DEFAULT_REGION')), # Uncomment the next line if you know exactly what Account and Region you # want to deploy the stack to. */ # env=core.Environment(account='123456789012', region='us-east-1'), # For more information, see https://docs.aws.amazon.com/cdk/latest/guide/environments.html env=core.Environment(region=cfg.aws_region, account=cfg.aws_account_id), cfg=cfg, nest=nest, ) app.synth()
def get_template(): app = core.App() AwsSacMeetupStack(app, "aws-sac-meetup", env=core.Environment( account=os.environ["CDK_DEFAULT_ACCOUNT"], region=os.environ["CDK_DEFAULT_REGION"])) return json.dumps(app.synth().get_stack("aws-sac-meetup").template)
def _create_environment_object(account: str, region: str) -> core.Environment: """create an aws cdk Environment object. Args: account: AWS account number: 12 numbers region: AWS region. e.g. eu-west-1 Returns: AWS cdk Environment object. """ account = (account if account is not None else os.environ.get("AWS_DEFAULT_ACCOUNT")) region = region if region is not None else os.environ.get( "AWS_DEFAULT_REGION") return core.Environment(account=account, region=region)
def __init__(self): app = core.App() _env = core.Environment(region="ap-northeast-2") ddb_stack = ShortURLDDB(app, id=f"ShortenUrlDDB", env=_env) iam_stack = UrlShortenIAMRole(app, id='ShortenUrlIAMRole', ddb_table=ddb_stack.ddb_table_arn) redirect_lambda_stack = ShortenUrlRedirectLambda(app, id=f"ShortenURLRedirectLambda", env=_env, ddb_table=ddb_stack.ddb_table_name, role=iam_stack.iam_role) create_lambda_stack = ShortenUrlCreateUrlLambda(app, id=f"ShortenURLCreateLambda", env=_env, ddb_table=ddb_stack.ddb_table_name, role=iam_stack.iam_role) ShortenUrlApiGWStack(app, id=f"ShortenURLApiGW", env=_env, redirect_handler=redirect_lambda_stack.handler, create_handler=create_lambda_stack.handler)
def test_get_function(self): stack = core.Stack(core.App(), 'test-stack', env=core.Environment(account='123456789012', region='us-east-1')) vpc = ec2.Vpc.from_lookup(stack, 'test-vpc', vpc_id='vpc-12345678') success_topic = sns.Topic(stack, 'SuccessTopic') failure_topic = sns.Topic(stack, 'FailureTopic') profile = emr_profile.EMRProfile( stack, 'test-profile', profile_name='test-profile', vpc=vpc) configuration = cluster_configuration.ClusterConfiguration( stack, 'test-configuration', configuration_name='test-configuration') function = emr_launch_function.EMRLaunchFunction( stack, 'test-function', launch_function_name='test-function', emr_profile=profile, cluster_configuration=configuration, cluster_name='test-cluster', description='test description', success_topic=success_topic, failure_topic=failure_topic, allowed_cluster_config_overrides=configuration.override_interfaces['default'], wait_for_cluster_start=False ) ssm = boto3.client('ssm') ssm.put_parameter( Name=f'{emr_profile.SSM_PARAMETER_PREFIX}/{profile.namespace}/{profile.profile_name}', Value=json.dumps(profile.to_json())) ssm.put_parameter( Name=f'{cluster_configuration.SSM_PARAMETER_PREFIX}/' f'{configuration.namespace}/{configuration.configuration_name}', Value=json.dumps(configuration.to_json())) ssm.put_parameter( Name=f'{emr_launch_function.SSM_PARAMETER_PREFIX}/{function.namespace}/{function.launch_function_name}', Value=json.dumps(function.to_json())) restored_function = emr_launch_function.EMRLaunchFunction.from_stored_function( stack, 'test-restored-function', namespace=function.namespace, launch_function_name=function.launch_function_name, ) self.assertEquals(function.to_json(), restored_function.to_json())
def __init__(self, scope: core.Construct, id: str, **kwargs) -> None: super().__init__(scope, id, **kwargs) def get_userdata(): with open('bootstrap.sh', 'r') as userdata: return userdata.read() vmie_ami = "ami-00bf35d2ab0bdb452" default_vpc = "vpc-e94d1f93" ec2_role = "arn:aws:iam::88888888888:role/KratosRole" account_id = "8888888888" vm_import_image = aws_ec2.GenericLinuxImage({"us-east-1": vmie_ami}) core.Environment(account=account_id) kratos_role = aws_iam.Role.from_role_arn(self, 'KratosXL', role_arn=ec2_role) aws_ec2.Instance(self, f"VMIE-{vmie_ami}", instance_type=aws_ec2.InstanceType('t2.micro'), role=kratos_role, machine_image=vm_import_image, security_group=aws_ec2.CfnSecurityGroup(self, id=f"SG-{vmie_ami}", group_description=f"SG-CDK-{vmie_ami}"), vpc=aws_ec2.Vpc.from_lookup(self, f'CDK-VPC--{vmie_ami}', vpc_id=default_vpc), user_data=aws_ec2.UserData.custom(get_userdata()), key_name="covidQuarantine")
def synth_stacks(app): aws_account = core.Environment( account=settings.AWS_ACCOUNT_ID, region=settings.AWS_DEFAULT_REGION, ) for config in StackConfig.get_configs(): vpc_stack = VPCStack( scope=app, id=f'{config.stack_name}-vpc', vpc_name=config.stack_name, env=aws_account, ) PlatformStack( scope=app, id=config.stack_name, vpc=vpc_stack.get_vpc(), config=config, env=aws_account, )
def main() -> None: _logger.debug("sys.argv: %s", sys.argv) context: "FoundationContext" = ContextSerDe.load_context_from_ssm( env_name=sys.argv[1], type=FoundationContext) ssl_cert_arn: str if len(sys.argv) == 3: ssl_cert_arn = sys.argv[2] elif len(sys.argv) == 2: ssl_cert_arn = "" else: raise ValueError("Unexpected number of values in sys.argv.") outdir = os.path.join(".orbit.out", context.name, "cdk", cast(str, context.stack_name)) os.makedirs(outdir, exist_ok=True) shutil.rmtree(outdir) app = App(outdir=outdir, ) @jsii.implements(core.IAspect) class AddDeployPathIAM: """ Implementing CDK Aspects to add optional IAM Role prefix to IAM roles """ def visit(self, node: core.IConstruct) -> None: """ Function to implement a path pattern """ if isinstance(node, iam.CfnRole): node.path = f"/{context.role_prefix}/" if context.role_prefix else "/" foundation_stack = FoundationStack( scope=app, id=cast(str, context.stack_name), context=context, ssl_cert_arn=ssl_cert_arn, env=core.Environment(account=os.environ["CDK_DEFAULT_ACCOUNT"], region=os.environ["CDK_DEFAULT_REGION"]), ) Aspects.of(scope=cast(core.IConstruct, foundation_stack)).add( cast(core.IAspect, AddDeployPathIAM())) app.synth(force=True)
def __init__(self, scope: core.Construct, id: str, **kwargs): super().__init__(scope, id, **kwargs) source_repo = codecommit.Repository( self, "sourcerepo", repository_name='ec2_generic_policy', description='Generic EC2 policy for using on EC2 Instance Roles') source_artifact = codepipeline.Artifact() cloud_assembly_artifact = codepipeline.Artifact() pipeline = pipelines.CdkPipeline( self, 'Pipeline', cloud_assembly_artifact=cloud_assembly_artifact, pipeline_name='EC2RolePolicy', source_action=cpactions.CodeCommitSourceAction( output=source_artifact, repository=source_repo, branch='master', trigger=cpactions.CodeCommitTrigger.EVENTS, action_name='OnRepoevent', run_order=1), synth_action=pipelines.SimpleSynthAction( source_artifact=source_artifact, cloud_assembly_artifact=cloud_assembly_artifact, install_command= 'npm install -g aws-cdk && pip install -r requirements.txt', #build_command='pytest unittests', synth_command='cdk synth')) # Add stages as required. app_env = core.Environment(account="194433038617", region="ap-southeast-2") prod_app = Ec2PolicyStage(self, 'Prod', env=app_env) prod_stage = pipeline.add_application_stage(prod_app)
def test_logging_is_activated(self): app = core.App() stack = GenericTestStack(app, 'test-stack', env=core.Environment(account="8373873873", region="eu-central-1")) logging_s3_bucket = aws_s3.Bucket(stack, 'alb01-logs') alb_cfg = AlbCfg( alb_name='TestALB', vpc=stack.vpc, subnets=stack.subnets, certificate_arns=[ 'arn:aws:acm:us-east-1:023475735288:certificate/ff6967d7-0fdf-4967-bd68-4caffc983447' ], cidr_ingress_ranges=['10.1.1.1/24', '10.2.2.2/32'], icmp_ranges=[], internet_facing=False, logging_s3_bucket=logging_s3_bucket, logging_prefix='ALB01AccessLogs') alb_construct = AlbHttpsConstruct(stack, 'albhttps', alb_cfg) add_access_denied_fix_response('fix401resp', alb_construct.https_listener) template = get_template(app, stack.stack_name) self.assertIn( '{"Type": "AWS::ElasticLoadBalancingV2::LoadBalancer", ' '"Properties": {"LoadBalancerAttributes": [{"Key": "access_logs.s3.enabled", "Value": "true"}, ' '{"Key": "access_logs.s3.bucket", "Value": {"Ref": "alb01logs', template, 'ALB has logging attribute for S3 bucket enabled') self.assertIn( '{"Key": "access_logs.s3.prefix", "Value": "ALB01AccessLogs"}]', template, 'ALB has properly set logging attribute prefix') self.assertIn('{"Type": "AWS::S3::Bucket"', template, 'S3 bucket is created') self.assertIn( '"/ALB01AccessLogs/AWSLogs/8373873873/*"', template, 'The bucket policy containing the correct path is created')
def __init__(self, *args, **kwargs): """Set all configurations that the stack class needs """ sts = boto3.client('sts') app = 'EricDemo' app_config = self._load_configs() self.config = DotDict( vpc_cidr='10.20.0.0/16', cluster_name=f'{app}Cluster', # API config api=DotDict( source_repo=app_config.api.source_repo, build_output=f'{app}ApiBuildOutput', pipeline=f'{app}ApiPipeline', ecr_repo=app_config.api.ecr_repo, table_name=app_config.api.table_name, ), # WEB config web=DotDict( source_repo=app_config.web.source_repo, build_output=f'{app}WebBuildOutput', pipeline=f'{app}WebPipeline', bucket_name=app_config.web.bucket_name, ), # Account info account_id=sts.get_caller_identity()['Account'], region_name=sts.meta.region_name, ) kwargs['env'] = core.Environment( account=self.config.account_id, region=self.config.region_name) super().__init__(*args, **kwargs)
value=self.namespace_outputs['NAME'], export_name="NSNAME") core.CfnOutput(self, "NSId", value=self.namespace_outputs['ID'], export_name="NSID") core.CfnOutput(self, "FE2BESecGrp", value=self.services_3000_sec_group.security_group_id, export_name="SecGrpId") core.CfnOutput(self, "ECSClusterName", value=self.cluster_outputs['NAME'], export_name="ECSClusterName") core.CfnOutput(self, "ECSClusterSecGrp", value=self.cluster_outputs['SECGRPS'], export_name="ECSSecGrpList") core.CfnOutput(self, "ServicesSecGrp", value=self.services_3000_sec_group.security_group_id, export_name="ServicesSecGrp") _env = core.Environment(account=getenv('AWS_ACCOUNT_ID'), region=getenv('AWS_DEFAULT_REGION')) stack_name = "stang-ecs-ec2-cluster" app = core.App() BaseVPCStack(app, stack_name, env=_env) app.synth()
code=lambda_.Code.from_asset(os.path.join(".", "s3_cleanup_lambda"))) weekly_on_sunday_cron = events.Rule( self, "Rule", schedule=events.Schedule.cron(minute='0', hour='0', week_day="SUN", month='*', year='*'), ) weekly_on_sunday_cron.add_target( targets.LambdaFunction(s3_cleanup_lambda)) # Event Sources midi_to_mp3_lambda.add_event_source( eventsources.SqsEventSource(queue=conversion_sqs)) midi_split_lambda.add_event_source( eventsources.SqsEventSource(queue=kickoff_sqs)) app = core.App() aws_account = core.Environment(account="463511281384", region="us-east-2") MIDIStack(app, "MIDI-Part-Splitter", env=aws_account) app.synth() if __name__ == '__main__': print(os.path.abspath('./midi_to_mp3_lambda/'))
self.deploy_stage = self.pipeline.add_stage( stage_name='Test_and_Build') # add build/test codebuild action self.deploy_stage.add_action( codepipeline_actions.CodeBuildAction( input=self.source_artifact, project=self.codebuild_deploy_ecr.project, action_name='Test_and_Build')) # add deploy stage self.deploy_stage = self.pipeline.add_stage( stage_name='API_Deployment') # add deploy codebuild action self.deploy_stage.add_action( codepipeline_actions.CodeBuildAction( input=self.source_artifact, project=self.codebuild_deploy_swagger.project, action_name='API_Deployment')) app = core.App() _env = core.Environment(account=config['CODEPIPELINE']['CDK_DEFAULT_ACCOUNT'], region=config['CODEPIPELINE']['AWS_DEFAULT_REGION']) ServiceAPIPipeline(app, "service-api-1-build-deploy-pipeline", env=_env) app.synth()
#!/usr/bin/env python3 from aws_cdk import core from infraestructure.vpc_stack import VpcStack from infraestructure.iam_stack import IamStack # Constants, default region region_name = "us-east-1" env_US = core.Environment(region=region_name) app = core.App() # Declare stacks using CDK vpc_stack = VpcStack(app, "vpc") iam_stack = IamStack(app, "iam-stack") app.synth()
from aws_cdk import core # from aws_cdk.aws_cdk_stack import AwsCdkStack from aws_cdk.mk.cdk_vpc_stack import CdkVpcStack from aws_cdk.demo.cdk_ec2_stack import CdkEc2Stack # from aws_cdk.mk.cdk_rds_stack import CdkRDSStack # from aws_cdk.mk.cdk_redis_stack import CdkREDISStack # from aws_cdk.mk.cdk_cf_stack import CdkCDNStack # from aws_cdk.cdk_ec2 import AppStack # from aws_cdk.mk.cdk_vpc_ec2_stack import CdkVpcEc2Stack # from aws_cdk.cdk_rds import CdkRdsStack # from aws_cdk.cdk_redis import CdkRedisStack # from aws_cdk.cdk_ecs import MyEcsConstructStack env = core.Environment(account="456843195142", region="us-east-1") app = core.App() # AwsCdkStack(app, "aws-cdk") vpc_stack = CdkVpcStack(app, "cdk-vpc") ec2_stack = CdkEc2Stack(app, "cdk-ec2") # ec2_stack = CdkEc2Stack(app, "cdk-ec2",vpc=vpc_stack.vpc,subnet_id=vpc_stack.public_subnet_a) # rds_stack = CdkRDSStack(app, "cdk-rds",vpc=vpc_stack.vpc,public_subnet_a=vpc_stack.public_subnet_a,public_subnet_c=vpc_stack.public_subnet_c,public_subnet_d=vpc_stack.public_subnet_d, ec2_sg_id=ec2_stack.security_group) # rds_stack = CdkRdsStack(app, "cdk-rds") # ecs_stack = MyEcsConstructStack(app, "cdk-ecs") # redis_stack = CdkRedisStack(app, "cdk-redis") # redis_stack = CdkREDISStack(app, "cdk-redis",vpc=vpc_stack.vpc,public_subnet_a=vpc_stack.public_subnet_a,public_subnet_c=vpc_stack.public_subnet_c,public_subnet_d=vpc_stack.public_subnet_d) # cf_stack = CdkCDNStack(app, "cdk-cf") # ec2_stack = CdkVpcEc2Stack(app, "cdk-ec2", env=env) # AppStack(app, "ec2", env=env)
#!/usr/bin/env python3 from aws_cdk import core from pycdk.pycdk_stack import PycdkStack env = core.Environment(region="eu-central-1") tags = {'bha':'teststack'} app = core.App() PycdkStack(app, "PycdkStack", env=env, tags=tags) app.synth()
ecs_task.default_container.add_mount_points( ecs.MountPoint(container_path="/opt/jobResults", source_volume="jobResults", read_only=False)) # -v $TMPDIR/certificates:/opt/commvault/Base/certificates ecs_task.add_volume( name="certificates", efs_volume_configuration=ecs.EfsVolumeConfiguration( file_system_id=commvault_file_system.file_system_id, transit_encryption="ENABLED", authorization_config=ecs.AuthorizationConfig( #iam="ENABLED", access_point_id=efs.AccessPoint( self, "certificates-access-point", path="/certificates", file_system=commvault_file_system).access_point_id))) ecs_task.default_container.add_mount_points( ecs.MountPoint(container_path="/opt/commvault/Base/certificates", source_volume="certificates", read_only=False)) app = core.App() step = app.node.try_get_context("env") config = yaml.load(open("env.yaml"), Loader=yaml.FullLoader) env = core.Environment(region=config["region"], account=config["account"]) CommVaultStack(app, config, "commvault-demo", env=env) app.synth()
#!/usr/bin/env python3 from aws_cdk import core from vijay_cdk_project.vijay_cdk_project_stack import VijayCdkProjectStack env_IN = core.Environment(region="ap-south-1") app = core.App() VijayCdkProjectStack(app, "vijay-cdk-project-dev", env=env_IN) VijayCdkProjectStack(app, "vijay-cdk-project-prod", is_prod=True, env=env_IN) app.synth()
#!/usr/bin/env python3 from aws_cdk import (aws_ec2 as ec2, core) from hello_world_cdk.hello_world_cdk_stack import HelloWorldCdkStack app = core.App() alcancioAccount = "519501257528" payClipExternalAccount = "381734387592" HelloWorldCdkStack(app, "hello-world-cdk", env=core.Environment(region="us-west-2", account=payClipExternalAccount)) app.synth()
from ir_cdk_stacks.ext_01_stack import Ext01Stack from ir_cdk_stacks.ext_06_stack import Ext06Stack from ir_cdk_stacks.in_clt_01_stack import InClt01Stack from ir_cdk_stacks.In_S3_01_Prod_Stack import InS301StackProd from ir_cdk_stacks.In_S3_01_Preprod_Stack import InS301PreprodStack from ir_cdk_stacks.In_S3_01_Dev_Stack import InS301DevStack from socialist_ir.config import Config config = Config.get_config() ACCOUNT = config.get("main", "account") REGION = config.get("main", "region") env_US = core.Environment(account=ACCOUNT, region=REGION) app = core.App() IrCdkStacksStack(app, "ir-cdk-stacks", env=env_US) InAur01Stack(app, "in-aur-01-stack", env=env_US) InAur02Stack(app, "in-aur-02-stack", env=env_US) InLam01Stack(app, "in-lam-01-stack", env=env_US) Ext01Stack(app, "ext-01-stack", env=env_US) Ext06Stack(app, "ext-06-stack", env=env_US) InClt01Stack(app, "in-clt-01-stack", env=env_US) InS301StackProd(app, "in-s3-01-prod-stack", env=env_US) InS301PreprodStack(app, "in-s3-01-preprod-stack", env=env_US) InS301DevStack(app, "in-s3-01-dev-stack", env=env_US)
#!/usr/bin/env python3 import os from aws_cdk import core from stacks.personal_site_stack import PersonalSiteStack account_number = os.environ['ACCOUNT_NUMBER'] app = core.App() env = core.Environment(region="us-east-1", account=account_number) PersonalSiteStack(app, "radiant-lounge-stack", env=env) app.synth()
#!/usr/bin/env python3 # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 import os from aws_cdk import core from mysiem.aes_siem_stack import MyAesSiemStack app = core.App() MyAesSiemStack(app, "aes-siem", description='SIEM on Amazon ES', env=core.Environment( account=os.environ['CDK_DEFAULT_ACCOUNT'], region=os.environ['CDK_DEFAULT_REGION'])) app.synth()
#!/usr/bin/env python3 import os from aws_cdk import core from minebot.minebot_stack import MinebotStack app = core.App() env = core.Environment(account=os.environ["CDK_DEFAULT_ACCOUNT"], region=os.environ["CDK_DEFAULT_REGION"]) MinebotStack(app, "minebot", env=env) app.synth()
#!/usr/bin/env python3 from aws_cdk import core from sample_app.vpc_stack import SampleVPCStack from sample_app.ec2_stack import SampleEC2Stack #from sample_app.alb_stack import SampleALBStack app = core.App() vpc_stack = SampleVPCStack( app, "Network", env=core.Environment(region="ap-northeast-2", account="my_account") ) #Network is named ~/*/* (firsted named), it works based on this name. ec2_stack = SampleEC2Stack(app, "Service", vpc=vpc_stack.vpc, env=core.Environment(region="ap-northeast-2", account="my_account")) app.synth()
#!/usr/bin/env python3 from aws_cdk import core from aws_cdk_pipeline_test.pipelines_stack import PipelineStack app = core.App() PipelineStack(app, 'aws-cdk-pipeline-test', env=core.Environment(account="356419192138", region="eu-central-1")) app.synth()