AssociateVpcCidrBlock - Amazon Elastic Compute Cloud


Associates a CIDR block with your VPC. You can associate a secondary IPv4 CIDR block, an Amazon-provided IPv6 CIDR block, or an IPv6 CIDR block from an IPv6 address pool that you provisioned through bring your own IP addresses (BYOIP). The IPv6 CIDR block size is fixed at /56.

You must specify one of the following in the request: an IPv4 CIDR block, an IPv6 pool, or an Amazon-provided IPv6 CIDR block.

For more information about associating CIDR blocks with your VPC and applicable restrictions, see VPC and subnet sizing in the Amazon Virtual Private Cloud User Guide.

Request Parameters

The following parameters are for this specific action. For more information about required and optional parameters that are common to all actions, see Common Query Parameters.


Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IPv6 addresses, or the size of the CIDR block.

Type: Boolean

Required: No


An IPv4 CIDR block to associate with the VPC.

Type: String

Required: No


An IPv6 CIDR block from the IPv6 address pool. You must also specify Ipv6Pool in the request.

To let Amazon choose the IPv6 CIDR block for you, omit this parameter.

Type: String

Required: No


The name of the location from which we advertise the IPV6 CIDR block. Use this parameter to limit the CIDR block to this location.

You must set AmazonProvidedIpv6CidrBlock to true to use this parameter.

You can have one IPv6 CIDR block association per network border group.

Type: String

Required: No


The ID of an IPv6 address pool from which to allocate the IPv6 CIDR block.

Type: String

Required: No


The ID of the VPC.

Type: String

Required: Yes

Response Elements

The following elements are returned by the service.


Information about the IPv4 CIDR block association.

Type: VpcCidrBlockAssociation object


Information about the IPv6 CIDR block association.

Type: VpcIpv6CidrBlockAssociation object


The ID of the request.

Type: String


The ID of the VPC.

Type: String


For information about the errors that are common to all actions, see Common client error codes.


Example 1

This example associates an IPv6 CIDR block with VPC vpc-1a2b3c4d.

Sample Request &VpcId=vpc-1a2b3c4d &AmazonProvidedIpv6CidrBlock=true &AUTHPARAMS

Sample Response

<AssociateVpcCidrBlock xmlns=""> <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> <ipv6CidrBlockAssociation> <ipv6CidrBlockState> <state>associating</state> </ipv6CidrBlockState> <associationId>vpc-cidr-assoc-e2a5408b</associationId> </ipv6CidrBlockAssociation> <vpcId>vpc-1a2b3c4d</vpcId> </AssociateVpcCidrBlock>

Example 2

This example associates the IPv4 CIDR block with VPC vpc-1a2b3c4d.

Sample Request &VpcId=vpc-1a2b3c4d &CidrBlock= &AUTHPARAMS

Sample Response

<AssociateVpcCidrBlockResponse xmlns=""> <requestId>33af6c54-1139-4d50-b4f7-15a8example</requestId> <vpcId>vpc-1a2b3c4d</vpcId> <cidrBlockAssociation> <associationId>vpc-cidr-assoc-0280ab6b</associationId> <cidrBlock></cidrBlock> <cidrBlockState> <state>associating</state> </cidrBlockState> </cidrBlockAssociation> </AssociateVpcCidrBlockResponse>

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: