Accepting a Net Peering

You can accept a Net peering requested between one of your Nets and another Net to enable communication between them.

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

  • If you use Cockpit to create a Net peering between two Nets that belong to your account, the request is automatically accepted.

  • A peering connection between two Nets works both ways. If an A-to-B connection is already created and accepted, creating a B-to-A connection is not necessary and would be automatically rejected.

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

Accepting a Net Peering Using Cockpit v2

  1. Click inside the Net Peerings dashboard to make checkboxes appear.

  2. Check the box of the Net peering you want to accept.
    The Net peering is selected and an action menu appears.

  3. Click IconLink Accept.
    A confirmation dialog box appears.

  4. Click Accept.
    The Net peering is accepted.

Accepting a Net Peering Using OSC CLI

The AcceptNetPeering command accepts a Net peering request.
To accept this request, you must be the owner of the peer Net. If you do not accept the request within 7 days, the state of the Net peering becomes expired.

A peering connection between two Nets works both ways. Therefore, when an A-to-B peering connection is accepted, any pending B-to-A peering connection is automatically rejected as redundant.

Request sample
$ osc-cli api AcceptNetPeering --profile "default" \
    --NetPeeringId "pcx-12345678"

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

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • NetPeeringId: The ID of the Net peering you want to accept.

The AcceptNetPeering command returns the following elements:

  • NetPeering: Information about the Net peering.

    • AccepterNet: Information about the accepter Net.

      • AccountId: The account ID of the owner of the accepter Net.

      • IpRange: The IP range for the accepter Net, in CIDR notation (for example, 10.0.0.0/16).

      • NetId: The ID of the accepter Net.

    • ExpirationDate: The date and time (UTC) at which the Net peerings expire.

    • NetPeeringId: The ID of the Net peering.

    • SourceNet: Information about the source Net.

      • AccountId: The account ID of the owner of the source Net.

      • IpRange: The IP range for the source Net, in CIDR notation (for example, 10.0.0.0/16).

      • NetId: The ID of the source Net.

    • State: Information about the state of the Net peering.

      • Message: Additional information about the state of the Net peering.

      • Name: The state of the Net peering (pending-acceptance | active | rejected | failed | expired | deleted).

    • Tags: One or more tags associated with the Net peering.

      • Key: The key of the tag, with a minimum of 1 character.

      • Value: The value of the tag, between 0 and 255 characters.

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

Result sample
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  },
  "NetPeering": {
    "Tags": [],
    "State": {
      "Name": "active",
      "Message": "Active"
    },
    "AccepterNet": {
      "NetId": "vpc-12345678",
      "IpRange": "172.16.0.0/16",
      "AccountId": "123456789012"
    },
    "ExpirationDate": "2063-04-05T00:00:00.000Z",
    "SourceNet": {
      "NetId": "vpc-12345678",
      "IpRange": "10.0.0.0/16",
      "AccountId": "123456789012"
    },
    "NetPeeringId": "pcx-12345678"
  }
}

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": "172.16.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 Methods

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