Reputation: 111
I'm creating a public route to my internet gateway. When I configure this through the GUI, it's no problem at all. When I try to do it through my Cloudformation template, it fails every time. Here is the construction of the Gateway, which doesn't have any issues:
GatewayToInternet:
Type: AWS::EC2::InternetGateway
DependsOn: VPC
Properties:
Tags:
- Key: Name
Value: !Sub ${AWS::StackName}-IGW
AttachGateway:
Type: AWS::EC2::VPCGatewayAttachment
Properties:
VpcId: !Ref VPC
InternetGatewayId: !Ref GatewayToInternet
Here is the route I'm attaching that is causing issues:
PublicDefaultRoute1
Type: AWS::EC2::Route
DependsOn: GatewayToInternet
Properties:
RouteTableId: !Ref PublicRouteTable
GatewayId: !Ref GatewayToInternet
DestinationCidrBlock: 0.0.0.0/0
The error I get from the CLI is: An error occurred (ValidationError) when calling the CreateStack operation: Template format error: YAML not well-formed. (line 261, column 5)
If I remove the route, everything works perfectly. I don't have any other routes attached to that Route Table, if that matters.
Upvotes: 0
Views: 155
Reputation: 2903
PublicDefaultRoute1
Type: AWS::EC2::Route
DependsOn: GatewayToInternet
Properties:
RouteTableId: !Ref PublicRouteTable
GatewayId: !Ref GatewayToInternet
DestinationCidrBlock: 0.0.0.0/0
should be
PublicDefaultRoute1:
Type: AWS::EC2::Route
DependsOn: GatewayToInternet
Properties:
RouteTableId: !Ref PublicRouteTable
GatewayId: !Ref GatewayToInternet
DestinationCidrBlock: 0.0.0.0/0
Note the colon (:) in PublicDefaultRoute1
Upvotes: 1