AWSTemplateFormatVersion: 2010-09-09 Description: This template updates the specified route table to allow communications via the VPC peering connection. Metadata: AWS::CloudFormation::Interface: ParameterLabels: PeerVpcCIDR: default: Peer VPC CIDR RouteTableIds: default: Route Table ID VpcPeeringConnectionId: default: VPC Peering Connection ID Parameters: PeerVpcCIDR: AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(1[6-9]|2[0-8]))$ ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28 Description: CIDR of the VPC Peer Type: String RouteTableIds: AllowedPattern: '^(rtb-[0-9a-f]{17})$|^((rtb-[0-9a-f]{17}(,|, ))*rtb-[0-9a-f]{17})$' ConstraintDescription: Must have a prefix of "rtb-". Followed by 17 characters (numbers, letters "a-f") Description: Route Table ID that will be updated to allow communications via the VPC peering connection Type: String VpcPeeringConnectionId: AllowedPattern: '^pcx-[0-9a-f]{17}$' ConstraintDescription: Must have a prefix of "pcx-". Followed by 17 characters (numbers, letters "a-f") Description: ID of the VPC Peering Connection Type: String Resources: PeerRoute1: Type: AWS::EC2::Route Properties: RouteTableId: !Select [0, !Split [',', !Ref RouteTableIds]] DestinationCidrBlock: !Ref PeerVpcCIDR VpcPeeringConnectionId: !Ref VpcPeeringConnectionId PeerRoute2: Type: AWS::EC2::Route Properties: RouteTableId: !Select [1, !Split [',', !Ref RouteTableIds]] DestinationCidrBlock: !Ref PeerVpcCIDR VpcPeeringConnectionId: !Ref VpcPeeringConnectionId