Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Dynamic az's
- Resources:
- PubPrivateVPC:
- Type: 'AWS::EC2::VPC'
- Properties:
- CidrBlock: 172.31.0.0/16
- PublicSubnet1:
- Type: 'AWS::EC2::Subnet'
- Properties:
- VpcId: !Ref PubPrivateVPC
- AvailabilityZone: us-east-1a
- CidrBlock: 172.31.1.0/24
- MapPublicIpOnLaunch: true
- PublicSubnet2:
- Type: 'AWS::EC2::Subnet'
- Properties:
- VpcId: !Ref PubPrivateVPC
- AvailabilityZone: us-east-1b
- CidrBlock: 172.31.2.0/24
- MapPublicIpOnLaunch: true
- PrivateSubnet1:
- Type: 'AWS::EC2::Subnet'
- Properties:
- VpcId: !Ref PubPrivateVPC
- AvailabilityZone: us-east-1a
- CidrBlock: 172.31.3.0/24
- MapPublicIpOnLaunch: false
- PrivateSubnet2:
- Type: 'AWS::EC2::Subnet'
- Properties:
- VpcId: !Ref PubPrivateVPC
- AvailabilityZone: us-east-1b
- CidrBlock: 172.31.4.0/24
- MapPublicIpOnLaunch: false
- InternetGateway:
- Type: 'AWS::EC2::InternetGateway'
- Properties:
- Tags:
- - Key: Name
- Value: !Join [_, [!Ref 'AWS::StackName']]
- - Key: Network
- Value: Public
- GatewayToInternet:
- Type: 'AWS::EC2::VPCGatewayAttachment'
- Properties:
- VpcId: !Ref PubPrivateVPC
- InternetGatewayId: !Ref InternetGateway
- PublicRouteTable:
- Type: 'AWS::EC2::RouteTable'
- Properties:
- VpcId: !Ref PubPrivateVPC
- Tags:
- - Key: Network
- Value: Public
- PublicRoute:
- Type: 'AWS::EC2::Route'
- DependsOn: GatewayToInternet
- Properties:
- RouteTableId: !Ref PublicRouteTable
- DestinationCidrBlock: 0.0.0.0/0
- GatewayId: !Ref InternetGateway
- PublicSubnet1RouteTableAssociation:
- Type: 'AWS::EC2::SubnetRouteTableAssociation'
- Properties:
- SubnetId: !Ref PublicSubnet1
- RouteTableId: !Ref PublicRouteTable
- PublicSubnet2RouteTableAssociation:
- Type: 'AWS::EC2::SubnetRouteTableAssociation'
- Properties:
- SubnetId: !Ref PublicSubnet2
- RouteTableId: !Ref PublicRouteTable
- NatGateway:
- Type: "AWS::EC2::NatGateway"
- DependsOn: NatPublicIP
- Properties:
- AllocationId: !GetAtt NatPublicIP.AllocationId
- SubnetId: !Ref PublicSubnet1
- NatPublicIP:
- Type: "AWS::EC2::EIP"
- DependsOn: PubPrivateVPC
- Properties:
- Domain: vpc
- PrivateRouteTable:
- Type: 'AWS::EC2::RouteTable'
- Properties:
- VpcId: !Ref PubPrivateVPC
- Tags:
- - Key: Network
- Value: Private
- PrivateRoute:
- Type: 'AWS::EC2::Route'
- Properties:
- RouteTableId: !Ref PrivateRouteTable
- DestinationCidrBlock: 0.0.0.0/0
- NatGatewayId: !Ref NatGateway
- PrivateSubnet1RouteTableAssociation:
- Type: 'AWS::EC2::SubnetRouteTableAssociation'
- Properties:
- SubnetId: !Ref PrivateSubnet1
- RouteTableId: !Ref PrivateRouteTable
- PrivateSubnet2RouteTableAssociation:
- Type: 'AWS::EC2::SubnetRouteTableAssociation'
- Properties:
- SubnetId: !Ref PrivateSubnet2
- RouteTableId: !Ref PrivateRouteTable
Add Comment
Please, Sign In to add comment