AWSTemplateFormatVersion: 2010-09-09 Description: This templates creates a VPC Peering connection. (Requester Account) Metadata: AWS::CloudFormation::Interface: ParameterGroups: - Label: default: Network Configuration Parameters: - VpcId - Label: default: VPC Peering Configuration Parameters: - PeerName - PeerOwnerId - PeerRoleARN - PeerVpcId ParameterLabels: PeerName: default: Peer Name PeerOwnerId: default: Peer Owner ID PeerRoleARN: default: Peer Role ARN PeerVpcId: default: Peer VPC ID VpcId: default: VPC ID Parameters: PeerName: Description: Name of the VPC Peer MaxLength: 255 Type: String PeerOwnerId: AllowedPattern: '^\d{12}$' ConstraintDescription: Must be 12 digits. Description: AWS account ID of the owner of the accepter VPC Type: String PeerRoleARN: AllowedPattern: '^arn:(aws[a-zA-Z-]*)?:iam::\d{12}:role\/([\w+=,.@-]*\/)*[\w+=,.@-]+' Description: ARN of the VPC peer role for the peering connection in another AWS account. Required when you are peering a VPC in a different AWS account. Type: String PeerVpcId: AllowedPattern: '^vpc-[0-9a-f]{17}$' ConstraintDescription: Must have a prefix of "vpc-". Followed by 17 characters (numbers, letters "a-f") Description: ID of the VPC with which you are creating the VPC peering connection Type: String VpcId: Description: ID of the VPC Type: AWS::EC2::VPC::Id Conditions: PeerRoleCondition: !Not [!Equals [!Ref PeerRoleARN, '']] Resources: VPCPeeringConnection: Type: AWS::EC2::VPCPeeringConnection Properties: VpcId: !Ref VpcId PeerVpcId: !Ref PeerVpcId PeerOwnerId: !Ref PeerOwnerId PeerRoleArn: !If [PeerRoleCondition, !Ref PeerRoleARN, !Ref AWS::NoValue] Tags: - Key: Name Value: !Ref PeerName Outputs: VPCPeeringConnectionId: Description: VPC Peering Connection ID Value: !Ref VPCPeeringConnection