Skip to content

Instantly share code, notes, and snippets.

@ksnabb
Last active October 28, 2017 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ksnabb/8fd0d70ab8155ad3fde52ed1089e85eb to your computer and use it in GitHub Desktop.
Save ksnabb/8fd0d70ab8155ad3fde52ed1089e85eb to your computer and use it in GitHub Desktop.
internet_gateway = stack.add_resource(
InternetGateway('InternetGateway')
)
route_table = stack.add_resource(RouteTable(
'RouteTable',
VpcId=Ref(vpc)
))
stack.add_resource(Route(
'RouteToInternet',
DestinationCidrBlock='0.0.0.0/0',
GatewayId=Ref(internet_gateway),
RouteTableId=Ref(route_table)
))
stack.add_resource(
VPCGatewayAttachment(
'GatewayAttachment',
VpcId=Ref(vpc),
InternetGatewayId=Ref(internet_gateway)
)
)
stack.add_resource(
SubnetRouteTableAssociation(
'PublicSubnetAssociation1',
SubnetId=Ref(public_subnet1),
RouteTableId=Ref(route_table)
)
)
stack.add_resource(
SubnetRouteTableAssociation(
'PublicSubnetAssociation2',
SubnetId=Ref(public_subnet2),
RouteTableId=Ref(route_table)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment