def __init__(self): app = App() _env = Environment(region="ap-northeast-2", account=account) cluster = EksTestStack(app, 'EksClusterStack', env=_env) IamOICProvider(app, 'EksOICIdentityProvider', eks_cluster=cluster.eks_cluster, env=_env) app.synth()
ghost_service_yaml_file.close() # print(ghost_service_yaml) eks_cluster.add_manifest("GhostServiceManifest", ghost_service_yaml) # Import ghost-ingress.yaml to a dictionary and submit it as a manifest to EKS # Read the YAML file ghost_ingress_yaml_file = open("ghost-ingress.yaml", 'r') ghost_ingress_yaml = yaml.load(ghost_ingress_yaml_file, Loader=yaml.FullLoader) ghost_ingress_yaml_file.close() # print(ghost_ingress_yaml) eks_cluster.add_manifest("GhostIngressManifest", ghost_ingress_yaml) app = App() if app.node.try_get_context("account").strip() != "": account = app.node.try_get_context("account") else: account = os.environ.get("CDK_DEPLOY_ACCOUNT", os.environ["CDK_DEFAULT_ACCOUNT"]) if app.node.try_get_context("region").strip() != "": region = app.node.try_get_context("region") else: region = os.environ.get("CDK_DEPLOY_REGION", os.environ["CDK_DEFAULT_REGION"]) ghost_stack = GhostStack(app, "GhostStack", env=Environment(account=account, region=region)) app.synth()
#!/usr/bin/env python3 import json import os from aws_cdk import App, Environment from cdk_smile.lambda_smile import SmileStack env_file = os.environ.get("ENV_FILE", "env_dev.json") with open(env_file) as json_file: stage_env = json.load(json_file) app = App() SmileStack(app, "cdk-smile", env=Environment(**stage_env)) app.synth()
#!/usr/bin/env python3 from aws_cdk import App, Environment from guard_duty.guard_duty_stack import StepFunctionMachine app = App() env = Environment(region='eu-west-2') StepFunctionMachine(app, "guard-duty", env=env) app.synth()
from aws_cdk import App, Environment from slack_app_constructs_cdk.slack_app_constructs_stack import \ SlackAppConstructsStack from slack_app_constructs_cdk.slack_app_oauth_constructs_stack import \ SlackAppOAuthConstructsStack ENV_STAGE = os.environ.get("ENV_STAGE", "dev") with open(f"env_{ENV_STAGE}.json") as json_file: stage_env = json.load(json_file) with open(f"settings_{ENV_STAGE}.json") as json_file: stage_settings = json.load(json_file) app_name = stage_settings["name"] app = App() SlackAppConstructsStack(app, f"{app_name}-SlackApp", stage_settings, env=Environment(**stage_env)) SlackAppOAuthConstructsStack(app, f"{app_name}-SlackAppSharing", stage_settings, env=Environment(**stage_env)) app.synth()
"""This is the main program for CDK entry""" # !/usr/bin/env python3 import os import sys from aws_cdk import Environment, App from swift_main_stack.main import SwiftMain region = os.environ["CDK_DEFAULT_REGION"] account = os.environ["CDK_DEFAULT_ACCOUNT"] if region == "" or account == "": print("Please set CDK_DEFAULT_REGION and CDK_DEFAULT_ACCOUNT in Env!") sys.exit() environment = Environment(region=region, account=account) app = App() main_stack = SwiftMain( app, "SWIFTMain-" + region, env=environment, description="Quick Start for SWIFT Connectivity (qs-1rlbqnpbe)") app.synth()
app = App() cicd = CodePipelineStack( app, 'aviv-cdk-cicd', connections={ 'aviv-group': 'aws:ssm:/aviv/ace/github/connection/aviv-group' }, codepipeline=dict(pipeline_name="aviv-cdk-python"), tags={ tag: app.node.try_get_context(tag) for tag in ['environment', 'organisation', 'team', 'scope', 'application'] }, env=Environment(account='605901617242', region='eu-west-1')) # cicd.pipeline.add_wave( # 'MyWave', # post=[ # pipelines.CodeBuildStep( # 'mbuild', # project_name='Aviv CDK python', # commands=[ # "echo -e '[pypi]\nusername = __token__\npassword = $PYPI_TOKEN'", # "python -m pip install twine", # "python setup.py sdist bdist_wheel", # "python3 -m twine upload --repository pypi dist/*" # ], # ) # ]
"domain_certificate_arn" ), "enable_s3_website_endpoint": app.node.try_get_context( "enable_s3_website_endpoint" ), "origin_custom_header_parameter_name": app.node.try_get_context( "origin_custom_header_parameter_name" ), "hosted_zone_id": app.node.try_get_context("hosted_zone_id"), "hosted_zone_name": app.node.try_get_context("hosted_zone_name"), } env = Environment( account=os.environ.get( "CDK_DEPLOY_ACCOUNT", os.environ.get("CDK_DEFAULT_ACCOUNT") ), region=os.environ.get( "CDK_DEPLOY_REGION", os.environ.get("CDK_DEFAULT_REGION") ), ) StaticSite = StaticSiteStack( scope=app, construct_id=f"{props['namespace']}-stack", props=props, env=env, description="Static Site using S3, CloudFront and Route53", ) app.synth()
#!/usr/bin/env python3 import os from aws_cdk import App, Environment from ecs_clusters.shared_ecs_cluster import SharedECSClusterStack from vpcs.shared_vpc_stack import SharedVPCStack app = App() ap_southeast_2 = Environment( account=os.environ.get("CDK_DEPLOY_ACCOUNT", os.environ["CDK_DEFAULT_ACCOUNT"]), region=os.environ.get("CDK_DEPLOY_REGION", os.environ["CDK_DEFAULT_REGION"]), ) vpc = SharedVPCStack(app, "SharedVPCStack", env=ap_southeast_2) ecs = SharedECSClusterStack(app, "SharedECSClusterStack", vpc=vpc.vpc, env=ap_southeast_2) app.synth()
#!/usr/bin/env python3 import json import os from aws_cdk import App, Environment from airflow_stack.airflow_stack import AirflowStack from airflow_stack.rds_elasticache_stack import RdsElasticacheEfsStack from airflow_stack.vpc_stack import VpcStack app = App() deploy_env = os.environ.get("ENV", "dev") config = json.loads(open("conf/{0}/config.json".format(deploy_env)).read()) us_east_env = Environment(account=config["account_id"], region="us-east-1") vpc_stack = VpcStack(app, f"vpc-{deploy_env}", deploy_env, config, env=us_east_env) db_redis_stack = RdsElasticacheEfsStack(app, f"airflow-db-{deploy_env}", deploy_env, vpc_stack.get_vpc(), config, env=us_east_env) db_redis_stack.add_dependency(vpc_stack) airflow_stack = AirflowStack(app, f"airflow-{deploy_env}", deploy_env, vpc_stack.get_vpc(),
from aws_cdk import Stack, Environment from aws_cdk import aws_apigateway, aws_route53, aws_route53_targets, aws_certificatemanager, aws_ec2 from constructs import Construct # we need default values here since aws-cdk-examples build synthesizes the app ACCOUNT = os.environ.get('WALTERSCO_ACCOUNT', '111111111111') REGION = os.environ.get('WALTERSCO_REGION', 'us-east-1') VPC_ID = os.environ.get('WALTERSCO_VPC_ID', 'vpc-11111111111111111') ZONE_NAME = os.environ.get('WALTERSCO_ZONE_NAME', 'yourdomain.com') ZONE_ID = os.environ.get('WALTERSCO_ZONE_ID', 'Z11FE11Z11DV1') ZONE_CERT = os.environ.get( 'WALTERSCO_ZONE_CERT', 'arn:aws:acm:us-east-1:111111111111:certificate/11111111-1111-1111-1111-111111111111' ) AWS_ENV = Environment(account=ACCOUNT, region=REGION) class WaltersCoStack(Stack): """ A base CDK stack class for all stacks defined in our fun little company. """ def __init__(self, scope: Construct, id: str, **kwargs): super().__init__(scope, id, env=AWS_ENV, **kwargs) # lookup our pre-created VPC by ID self._vpc = aws_ec2.Vpc.from_lookup(self, "vpc", vpc_id=VPC_ID) @property def waltersco_vpc(self) -> aws_ec2.IVpc: """
#!/usr/bin/env python3 from aws_cdk import App, Environment from cdk_vpc_ec2.cdk_vpc_ec2_stack import CdkVpcEc2Stack # Define your account id to make import vpc work env_cn = Environment(account="YOUR_ACCOUNT_ID_WITHOUT_HYPHEN", region="cn-northwest-1") app = App() CdkVpcEc2Stack(app, "cdk-vpc-ec2", env=env_cn) app.synth()
class ClientVpnStack(Stack): def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None: super().__init__(scope, construct_id, **kwargs) vpc = ec2.Vpc( self, 'Network', cidr='10.11.12.0/22', max_azs=3, nat_gateways=1, ) vpc.add_client_vpn_endpoint( 'VpnEndpoint', cidr='10.11.252.0/22', # Non-overlapping server_certificate_arn=server_certificate_arn, client_certificate_arn=client_certificate_arn, ) app = App() ClientVpnStack( app, 'ClientVpn', env=Environment(account=os.getenv('CDK_DEFAULT_ACCOUNT'), region=os.getenv('CDK_DEFAULT_REGION')), ) app.synth()