Accepting a VPC Peering Connection

You can accept a VPC peering connection requested between one of your Virtual Private Clouds (VPCs) and another VPC to enable communication between them.

This action updates the state of the connection from pending-acceptance to active. Only the owner of the accepter VPC can accept a connection request. You cannot yourself accept a request you sent to another account. For more information, see About VPC Peering Connections.

  • If you use Cockpit v1 to create a VPC peering connection between two VPCs that belong to your account, the request is automatically accepted.

  • A peering connection between two VPCs works both ways. Therefore, you do not need to create a B-to-A connection if an A-to-B connection is already created and accepted.

For safety reasons, never accept a VPC peering connection with an unknown account.
You can reject the connection, or let the request expire. For more information, see Rejecting a VPC Peering Connection or About VPC Peering Connections > Lifecycle.

Accepting a VPC Peering Connection Using Cockpit

  1. Click VPC > VPC Peering Connections.

  2. Select the VPC peering connection you want to accept.
    The VPC peering connection is selected.

  3. Click Accept .
    A confirmation dialog box appears.

  4. Click Accept to validate.
    The VPC peering connection is accepted.

Accepting a VPC Peering Connection Using AWS CLI

To accept a VPC peering connection, use the accept-vpc-peering-connection command following this syntax:

Request sample
$ aws ec2 accept-vpc-peering-connection \
    --profile YOUR_PROFILE \
    --vpc-peering-connection-id pcx-111aaa111 \
    --endpoint https://fcu.eu-west-2.outscale.com

This command contains the following attributes that you need to specify:

  • (optional) profile: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI.

  • vpc-peering-connection-id: The ID of the VPC peering connection you want to accept.

  • endpoint: The endpoint corresponding to the Region you want to send the request to.

The accept-vpc-peering-connection command returns the following elements:

  • VpcPeeringConnection: Information about the VPC peering connection. This element contains the following information:

    • AccepterVpcInfo: Information about the accepter VPC. This element contains the following information:

      • CidrBlock: The range of IPs of the VPC, in CIDR notation.

      • OwnerId: The account ID of the owner of the VPC.

      • VpcId: The ID of the VPC.

    • ExpirationTime: The date after which the VPC peering connection request in the pending-acceptance state would have expired.

    • RequesterVpcInfo: Information about the requester VPC. This element contains the following information:

      • CidrBlock: The range of IPs of the VPC, in CIDR notation.

      • OwnerId: The account ID of the owner of the VPC.

      • VpcId: The ID of the VPC.

    • Status: Information about the state of the VPC peering connection. This element contains the following information:

      • Code: The state of the VPC peering connection (active).

      • Message: Additional information about the state of the VPC peering connection.

    • Tags: One or more tags associated with the VPC peering connection. This element contains the following information:

      • Key: The key of the tag.

      • Value: The value of the tag.

    • VpcPeeringConnectionId: The ID of the VPC peering connection.

Result sample
{
    "VpcPeeringConnection": {
        "AccepterVpcInfo": {
            "CidrBlock": "175.0.0.0/28",
            "OwnerId": "888877776666",
            "VpcId": "vpc-11122233"
        },
        "ExpirationTime": "2018-03-26T13:01:33.176Z",
        "RequesterVpcInfo": {
            "CidrBlock": "10.0.0.0/28",
            "OwnerId": "444455556666",
            "VpcId": "vpc-1a2b3c4d"
        },
        "Status": {
            "Code": "active",
            "Message": "Active"
        },
        "Tags": [],
        "VpcPeeringConnectionId": "pcx-111aaa11"
    }
}

The specified VPC peering connection is accepted.

Related Pages

Corresponding API Method

AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.