I am trying to create CloudFormation Stack that will create VPC, Subnets, IGW, Route Tables, NAT Gateway, Associate Subnets with RTs etc
My Stack is failing where NAT Gateway is trying to create Rule for Private Route Table to create Route Rule for NAT GW.
# Punblic Elastic IP for NAT Gateway in Zone 2A
eipSubnetA:
Type: AWS::EC2::EIP
Properties:
Domain: vpc
# NAT Gateway in Public Subnet 2A
natSubnetA:
Type: AWS::EC2::NatGateway
Properties:
AllocationId:
Fn::GetAtt: [eipSubnetA, AllocationId]
SubnetId:
Ref: PRODSubnetPublic2a
Tags:
- Key: Name
Value: nat-Subnet-a
# Route through NAT Gateway
NATRoute:
Type: AWS::EC2::Route
Properties:
RouteTableId:
Ref: PRODRTPrivate
DestinationCidrBlock: 0.0.0.0/0
GatewayId:
Ref: natSubnetA
Error I am seeing in the CloudFormation Events tab is:
The following resource(s) failed to create: [NATRoute]. . Rollback requested by user
Route did not stabilize in expected time
Not sure what am I missing?
# Private Subnets to Route Table Association
PrivateSubnetA:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
SubnetId:
Ref: PRODSubnetPrivate2a
RouteTableId:
Ref: PRODRTPrivate
PrivateSubnetB:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
SubnetId:
Ref: PRODSubnetPrivate2b
RouteTableId:
Ref: PRODRTPrivate
# Punblic Elastic IP for NAT Gateway in Zone 2A
eipSubnetA:
Type: AWS::EC2::EIP
Properties:
Domain: vpc
# NAT Gateway in Public Subnet 2A
natSubnetA:
Type: AWS::EC2::NatGateway
Properties:
AllocationId:
Fn::GetAtt: [eipSubnetA, AllocationId]
SubnetId:
Ref: PRODSubnetPublic2a
Tags:
- Key: Name
Value: nat-Subnet-a
# Route through NAT Gateway
NATRoute:
Type: AWS::EC2::Route
Properties:
RouteTableId:
Ref: PRODRTPrivate
DestinationCidrBlock: 0.0.0.0/0
GatewayId:
Ref: natSubnetA
I expect Private Route Table should have Route NATGateway for Destination 0.0.0.0/0
I found the mistake I made, resolved it by replacing GatewayId: to NatGatewayId:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With