I am a beginner to Cloud Formation and I am using the yaml code below to try and update a pipeline in AWS. Upon committing the yaml code I get the following error
“[/Description] ‘null’ values are not allowed in templates (Service: AmazonCloudFormation; Status Code: 400; Error Code: ValidationError; Request ID: 265e178d-1e7a-4852-8008-f5848f51f4f8; Proxy: null)
I went back to my code and validated it with an online YAML validator and i get where the error is coming from but I am failing to fix the problem. I am getting this error:
Error: unknown tag !<!Ref> at line 27, column 34:
InternetGatewayId: !Ref IGW
^
Line : undefined undefined
My YAML code is below:
AWSTemplateFormatVersion: 2010-09-09
Description: Network layer for the cafe
Resources:
VPC:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 10.0.0.0/16
EnableDnsSupport: true
EnableDnsHostnames: true
Tags:
- Key: Name
Value: Cafe VPC
IGW:
Type: AWS::EC2::InternetGateway
Properties:
Tags:
- Key: Name
Value: Cafe IGW
VPCtoIGWConnection:
Type: AWS::EC2::VPCGatewayAttachment
DependsOn:
- IGW
- VPC
Properties:
InternetGatewayId: !Ref IGW
VpcId: !Ref VPC
PublicRouteTable:
Type: AWS::EC2::RouteTable
DependsOn: VPC
Properties:
VpcId: !Ref VPC
Tags:
- Key: Name
Value: Cafe Public Route Table
PublicRoute:
Type: AWS::EC2::Route
DependsOn:
- PublicRouteTable
- VPCtoIGWConnection
Properties:
DestinationCidrBlock: 0.0.0.0/0
GatewayId: !Ref IGW
RouteTableId: !Ref PublicRouteTable
PublicSubnet:
Type: AWS::EC2::Subnet
DependsOn: VPC
Properties:
VpcId: !Ref VPC
MapPublicIpOnLaunch: true
CidrBlock: 10.0.0.0/24
AvailabilityZone: !Select
- 0
- !GetAZs
Ref: AWS::Region
Tags:
- Key: Name
Value: Cafe Public Subnet
PublicRouteTableAssociation:
Type: AWS::EC2::SubnetRouteTableAssociation
DependsOn:
- PublicRouteTable
- PublicSubnet
Properties:
RouteTableId: !Ref PublicRouteTable
SubnetId: !Ref PublicSubnet
I tried searching from AWS documentation but I don see where the error is coming from.
3