AWS Fundamentals Logo
AWS Fundamentals
L1 ConstructAWS::EC2::VPCPeeringConnection

CfnVPCPeeringConnection

Requests a VPC peering connection between two VPCs: a requester VPC that you own and an accepter VPC with which to create the connection. The accepter VPC can belong to a different AWS account and can be in a different Region than the requester VPC. The requester VPC and accepter VPC cannot have overlapping CIDR blocks. If you create a VPC peering connection request between VPCs with overlapping CIDR blocks, the VPC peering connection has a status of `failed` . If the VPCs belong to different accounts, the acceptor account must have a role that allows the requester account to accept the VPC peering connection. For an example, see [Walkthrough: Peer with a VPC in another AWS account](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/peer-with-vpc-in-another-account.html) . If the requester and acceptor VPCs are in the same account, the peering request is accepted without a peering role.

Import

import { CfnVPCPeeringConnection } from 'aws-cdk-lib/aws-ec2';

Or use the module namespace:

import * as ec2 from 'aws-cdk-lib/aws-ec2';
// ec2.CfnVPCPeeringConnection

Properties

Configuration passed to the constructor as CfnVPCPeeringConnectionProps.

peerVpcIdRequired
string | IVPCRef

The ID of the VPC with which you are creating the VPC peering connection. You must specify this parameter in the request.

vpcIdRequired
string | IVPCRef

The ID of the VPC.

assumeRoleRegionOptional
string

The Region code to use when calling Security Token Service (STS) to assume the PeerRoleArn, if provided.

peerOwnerIdOptional
string

The AWS account ID of the owner of the accepter VPC. Default: Your AWS account ID

peerRegionOptional
string

The Region code for the accepter VPC, if the accepter VPC is located in a Region other than the Region in which you make the request. Default: The Region in which you make the request.

peerRoleArnOptional
string

The Amazon Resource Name (ARN) of the VPC peer role for the peering connection in another AWS account. This is required when you are peering a VPC in a different AWS account.

tagsOptional
CfnTag[]

Any tags assigned to the resource.

CloudFormation Resource

This L1 construct maps directly to the following CloudFormation resource type.

Get the Amazon EC2 Cheat Sheet

Everything you need to know about Amazon EC2 on one page. HD quality, print-friendly.

Download Free Infographic