Create or delete a VPC peering connection
To create a VPC peering connection, first create a request to peer with another VPC. You can request a VPC peering connection with another VPC in your account, or with a VPC in a different AWS account. For an inter-Region VPC peering connection where the VPCs are in different Regions, the request must be made from the Region of the requester VPC.
To activate the request, the owner of the accepter VPC must accept the request. For an
inter-Region VPC peering connection, the request must be accepted in the Region of the
accepter VPC. For more information, see Accept or reject a VPC peering connection. For more information about the Pending acceptance
peering connection status, see VPC peering connection lifecycle.
Tasks
- Prerequisites
- Create with VPCs in the same account and Region
- Create with VPCs in the same account and different Regions
- Create with VPCs in different accounts and the same Region
- Create with VPCs in different accounts and Regions
- Create a VPC peering connection using the command line
- Delete a VPC peering connection
Prerequisites
-
Review the limitations and rules for VPC peering connections.
-
Ensure that your VPCs do not have overlapping IPv4 CIDR blocks. If they overlap, the status of the VPC peering connection immediately goes to
failed
. This limitation applies even if the VPCs have unique IPv6 CIDR blocks.
Create with VPCs in the same account and Region
To create a VPC peering connection with VPCs in the same account and Region
Open the Amazon VPC console at https://console.aws.amazon.com/vpc/
. -
In the navigation pane, choose Peering connections.
-
Choose Create peering connection.
-
Configure the following information, and choose Create peering connection when you are done:
-
Name: You can optionally name your VPC peering connection.
-
VPC ID (Requester): Select the VPC in your account with which you want to create the VPC peering connection.
-
For Select another VPC to peer with, choose My account and select another of your VPCs.
-
(Optional) To add a tag, choose Add new tag and enter the tag key and value.
-
-
Choose Actions, Accept request.
-
When prompted for confirmation, choose Accept request.
-
Choose Modify my route tables now to add a route to the VPC route table so that you can send and receive traffic across the peering connection. For more information, see Update your route tables for a VPC peering connection.
Create with VPCs in the same account and different Regions
To create a VPC peering connection with VPCs in the same account and different Regions
Open the Amazon VPC console at https://console.aws.amazon.com/vpc/
. -
In the navigation pane, choose Peering connections.
-
Choose Create peering connection.
-
Configure the following information, and choose Create peering connection when you are done:
-
Name: You can optionally name your VPC peering connection. Doing so creates a tag with a key of
Name
and the value that you specify. -
VPC ID (Requester): Select the requester VPC in your account with which to request the VPC peering connection.
-
Account: Choose My account.
-
Region: Choose Another region and select the Region for the accepter VPC.
-
VPC ID (Accepter): Select the accepter VPC.
-
-
In the Region selector, select the Region of the accepter VPC.
-
In the navigation pane, choose Peering connections. Select the VPC peering connection that you created, and choose Actions, Accept request.
-
When prompted for confirmation, choose Accept request.
-
Choose Modify my route tables now to add a route to the VPC route table so that you can send and receive traffic across the peering connection. For more information, see Update your route tables for a VPC peering connection.
Create with VPCs in different accounts and the same Region
To request a VPC peering connection with VPCs in different accounts and the same Region
Open the Amazon VPC console at https://console.aws.amazon.com/vpc/
. -
In the navigation pane, choose Peering connections.
-
Choose Create peering connection.
-
Configure the information as follows, and choose Create peering connection when you are done:
-
Name: You can optionally name your VPC peering connection. Doing so creates a tag with a key of
Name
and a value that you specify. This tag is only visible to you; the owner of the peer VPC can create their own tags for the VPC peering connection. -
VPC ID (Requester): Select the VPC in your account with which to create the VPC peering connection.
-
Account: Choose Another account.
-
Account ID: Enter the ID of the AWS account that owns the accepter VPC.
-
VPC ID (Accepter): Enter the ID of the VPC with which to create the VPC peering connection.
-
Create with VPCs in different accounts and Regions
To request a VPC peering connection with VPCs in different accounts and Regions
Open the Amazon VPC console at https://console.aws.amazon.com/vpc/
. -
In the navigation pane, choose Peering connections.
-
Choose Create peering connection.
-
Configure the information as follows, and choose Create peering connection when you are done:
-
Name: You can optionally name your VPC peering connection. Doing so creates a tag with a key of
Name
and a value that you specify. This tag is only visible to you; the owner of the peer VPC can create their own tags for the VPC peering connection. -
VPC ID (Requester): Select the VPC in your account with which to create the VPC peering connection.
-
Account: Choose Another account.
-
Account ID: Enter the ID of the AWS account that owns the accepter VPC.
-
Region: Choose Another region and select the Region in which the accepter VPC resides.
-
VPC ID (Accepter): Enter the ID of the VPC with which to create the VPC peering connection.
-
Create a VPC peering connection using the command line
You can create a VPC peering connection using the following commands:
-
create-vpc-peering-connection (AWS CLI)
-
New-EC2VpcPeeringConnection (AWS Tools for Windows PowerShell)
Delete a VPC peering connection
Either owner of a VPC in a peering connection can delete the VPC peering
connection at any time. You can also delete a VPC peering connection that you've
requested that is still in the pending-acceptance
state.
You cannot delete the VPC peering connection when the VPC peering connection is in
the rejected
state. We automatically delete the connection for you.
Deleting a VPC in the Amazon VPC console that's part of an active VPC peering connection also
deletes the VPC peering connection. If you have requested a VPC peering connection with a
VPC in another account, and you delete your VPC before the other party has accepted the
request, the VPC peering connection is also deleted. You cannot delete a VPC for which you
have a pending-acceptance
request from a VPC in another account. You must first
reject the VPC peering connection request.
When you delete a peering connection, the status is set to Deleting
and then
Deleted
. After you delete a connection, it can't be accepted, rejected, or edited.
For more information about how long the peering connection remains visible, see VPC peering connection lifecycle.
To delete a VPC peering connection
Open the Amazon VPC console at https://console.aws.amazon.com/vpc/
. -
In the navigation pane, choose Peering connections.
-
Select the VPC peering connection.
-
Choose Actions, Delete peering connection.
-
When prompted for confirmation, enter
delete
and then choose Delete.
To delete a VPC peering connection using the command line or an API
delete-vpc-peering-connection (AWS CLI)
Remove-EC2VpcPeeringConnection (AWS Tools for Windows PowerShell)
DeleteVpcPeeringConnection (Amazon EC2 Query API)