cdk_vpc_stack.py 1.0 KB

1234567891011121314151617181920212223242526
  1. from aws_cdk import core
  2. import aws_cdk.aws_ec2 as ec2
  3. class CdkVpcStack(core.Stack):
  4. def __init__(self, scope: core.Construct, _id: str, **kwargs) -> None:
  5. super().__init__(scope, _id, **kwargs)
  6. self.vpc = ec2.Vpc(self, "VPC",
  7. max_azs=2,
  8. cidr="10.10.0.0/16",
  9. subnet_configuration=[ec2.SubnetConfiguration(
  10. subnet_type=ec2.SubnetType.PUBLIC,
  11. name="Public",
  12. cidr_mask=24
  13. )
  14. ]
  15. )
  16. self.vpc.add_s3_endpoint("s3ep",
  17. [ec2.SubnetSelection(subnet_type=ec2.SubnetType.PUBLIC)])
  18. # self.vpc.add_dynamo_db_endpoint("ddbep",
  19. # [ec2.SubnetSelection(subnet_type=ec2.SubnetType.PUBLIC)])
  20. # self.vpc.add_interface_endpoint("sqsep",
  21. # ec2.InterfaceVpcEndpointAwsService.SQS)