Skip to content

Instantly share code, notes, and snippets.

@youngsoul
Created March 11, 2022 17:46
Show Gist options
  • Save youngsoul/4d26f5e263616d1d2acde8f5c3df9ac4 to your computer and use it in GitHub Desktop.
Save youngsoul/4d26f5e263616d1d2acde8f5c3df9ac4 to your computer and use it in GitHub Desktop.
VPC Python CDK Example
vpc = ec2.Vpc(self, f'{resource_prefix}-Vpc',
cidr='10.40.0.0/16',
nat_gateways=1,
max_azs=2,
enable_dns_hostnames=True,
enable_dns_support=True,
subnet_configuration=[
ec2.SubnetConfiguration(
name=f"{resource_prefix}-Public-subnet",
subnet_type=ec2.SubnetType.PUBLIC,
cidr_mask=24
),
ec2.SubnetConfiguration(
name=f"{resource_prefix}-Private-subnet",
subnet_type=ec2.SubnetType.PRIVATE_WITH_NAT,
cidr_mask=24
),
ec2.SubnetConfiguration(
name=f"{resource_prefix}-Isolated-subnet",
subnet_type=ec2.SubnetType.PRIVATE_ISOLATED,
cidr_mask=24
)
],
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment