Skip to content

EC2  >  Operations  >  create_vpc_peering_connection

create_vpc_peering_connection

Operation

create_vpc_peering_connection async

create_vpc_peering_connection(input: CreateVpcPeeringConnectionInput, plugins: list[Plugin] | None = None) -> CreateVpcPeeringConnectionOutput

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 another Amazon Web Services account and can be in a different Region to the requester VPC. The requester VPC and accepter VPC cannot have overlapping CIDR blocks.

Note

Limitations and rules apply to a VPC peering connection. For more information, see the VPC peering limitations in the VPC Peering Guide.

The owner of the accepter VPC must accept the peering request to activate the peering connection. The VPC peering connection request expires after 7 days, after which it cannot be accepted or rejected.

If you create a VPC peering connection request between VPCs with overlapping CIDR blocks, the VPC peering connection has a status of failed.

Parameters:

Name Type Description Default
input CreateVpcPeeringConnectionInput

An instance of CreateVpcPeeringConnectionInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
CreateVpcPeeringConnectionOutput

An instance of CreateVpcPeeringConnectionOutput.

Input

CreateVpcPeeringConnectionInput dataclass

Bases: _SerdeShape

Dataclass for CreateVpcPeeringConnectionInput structure.

Attributes

dry_run class-attribute instance-attribute
dry_run: bool | None = ...

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

peer_owner_id class-attribute instance-attribute
peer_owner_id: str | None = ...

The Amazon Web Services account ID of the owner of the accepter VPC.

Default: Your Amazon Web Services account ID

peer_region class-attribute instance-attribute
peer_region: str | None = ...

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.

peer_vpc_id class-attribute instance-attribute
peer_vpc_id: str | None = ...

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

tag_specifications class-attribute instance-attribute
tag_specifications: list[TagSpecification] | None = ...

The tags to assign to the peering connection.

vpc_id class-attribute instance-attribute
vpc_id: str | None = ...

The ID of the requester VPC. You must specify this parameter in the request.

Output

CreateVpcPeeringConnectionOutput dataclass

Bases: _SerdeShape

Dataclass for CreateVpcPeeringConnectionOutput structure.

Attributes

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.

vpc_peering_connection class-attribute instance-attribute
vpc_peering_connection: VpcPeeringConnection | None = ...

Information about the VPC peering connection.