Cloudformation template with VPC and NAT Gateway for the second example from http://rozchmurzeni.pl/vpc---prywatne-podsieci
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: 2010-09-09 | |
Description: >- | |
VPC with NAT Gateway for the second example from http://rozchmurzeni.pl/vpc---prywatne-podsieci | |
Resources: | |
Vpc: | |
Type: AWS::EC2::VPC | |
Properties: | |
CidrBlock: 10.0.0.0/16 | |
EnableDnsHostnames: true | |
InternetGateway: | |
Type: AWS::EC2::InternetGateway | |
InternetGatewayAttachment: | |
Type: AWS::EC2::VPCGatewayAttachment | |
Properties: | |
InternetGatewayId: !Ref InternetGateway | |
VpcId: !Ref Vpc | |
# Publiczny subnet | |
PublicRouteTable: | |
Type: AWS::EC2::RouteTable | |
Properties: | |
VpcId: !Ref Vpc | |
InternetRoute: | |
Type: AWS::EC2::Route | |
Properties: | |
DestinationCidrBlock: 0.0.0.0/0 | |
RouteTableId: !Ref PublicRouteTable | |
GatewayId: !Ref InternetGateway | |
PublicSubnet: | |
Type: AWS::EC2::Subnet | |
Properties: | |
AvailabilityZone: eu-west-1a | |
CidrBlock: 10.0.1.0/24 | |
MapPublicIpOnLaunch: true | |
VpcId: !Ref Vpc | |
PublicSubnetTableAssociation: | |
Type: AWS::EC2::SubnetRouteTableAssociation | |
Properties: | |
RouteTableId: !Ref PublicRouteTable | |
SubnetId: !Ref PublicSubnet | |
# NAT gateway | |
ElasticIpForNat: | |
Type: AWS::EC2::EIP | |
Properties: | |
Domain: vpc | |
NatGateway: | |
Type: AWS::EC2::NatGateway | |
Properties: | |
AllocationId: !GetAtt ElasticIpForNat.AllocationId | |
SubnetId: !Ref PublicSubnet | |
# Subnet aplikacji | |
ApplicationSubnetRouteTable: | |
Type: AWS::EC2::RouteTable | |
Properties: | |
VpcId: !Ref Vpc | |
InternetRoute: | |
Type: AWS::EC2::Route | |
Properties: | |
DestinationCidrBlock: 0.0.0.0/0 | |
RouteTableId: !Ref ApplicationSubnetRouteTable | |
NatGatewayId: !Ref NatGateway | |
ApplicationSubnet: | |
Type: AWS::EC2::Subnet | |
Properties: | |
AvailabilityZone: eu-west-1a | |
CidrBlock: 10.0.3.0/24 | |
VpcId: !Ref Vpc | |
ApplicationSubnetTableAssociation: | |
Type: AWS::EC2::SubnetRouteTableAssociation | |
Properties: | |
RouteTableId: !Ref ApplicationSubnetRouteTable | |
SubnetId: !Ref ApplicationSubnet | |
# Subnet bazy danych | |
DatabaseRouteTable: | |
Type: AWS::EC2::RouteTable | |
Properties: | |
VpcId: !Ref Vpc | |
DatabaseSubnet: | |
Type: AWS::EC2::Subnet | |
Properties: | |
AvailabilityZone: eu-west-1a | |
CidrBlock: 10.0.4.0/24 | |
VpcId: !Ref Vpc | |
DatabaseSubnetTableAssociation: | |
Type: AWS::EC2::SubnetRouteTableAssociation | |
Properties: | |
RouteTableId: !Ref DatabaseRouteTable | |
SubnetId: !Ref DatabaseSubnet |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment