CreateSecondarySubnet - Amazon Elastic Compute Cloud

CreateSecondarySubnet

Creates a secondary subnet in a secondary network.

A secondary subnet CIDR block must not overlap with the CIDR block of an existing secondary subnet in the secondary network. After you create a secondary subnet, you can't change its CIDR block.

The allowed size for a secondary subnet CIDR block is between /28 netmask (16 IP addresses) and /12 netmask (1,048,576 IP addresses). Amazon reserves the first four IP addresses and the last IP address in each secondary subnet for internal use.

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.

AvailabilityZone

The Availability Zone for the secondary subnet. You cannot specify both AvailabilityZone and AvailabilityZoneId in the same request.

Type: String

Required: No

AvailabilityZoneId

The ID of the Availability Zone for the secondary subnet. This option is preferred over AvailabilityZone as it provides a consistent identifier across AWS accounts. You cannot specify both AvailabilityZone and AvailabilityZoneId in the same request.

Type: String

Required: No

ClientToken

Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensure Idempotency.

Type: String

Required: No

DryRun

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.

Type: Boolean

Required: No

Ipv4CidrBlock

The IPv4 CIDR block for the secondary subnet. The CIDR block size must be between /12 and /28.

Type: String

Required: Yes

SecondaryNetworkId

The ID of the secondary network in which to create the secondary subnet.

Type: String

Required: Yes

TagSpecification.N

The tags to assign to the secondary subnet.

Type: Array of TagSpecification objects

Required: No

Response Elements

The following elements are returned by the service.

clientToken

Unique, case-sensitive identifier to ensure the idempotency of the request. Only returned if a client token was provided in the request.

Type: String

requestId

The ID of the request.

Type: String

secondarySubnet

Information about the secondary subnet.

Type: SecondarySubnet object

Errors

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

Examples

Example

This example creates a secondary subnet with a /24 CIDR block in the specified secondary network and Availability Zone.

Sample Request

https://ec2.amazonaws.com/?Action=CreateSecondarySubnet &SecondaryNetworkId=sn-0123456789abcdef0 &Ipv4CidrBlock=10.0.0.0/24 &AvailabilityZoneId=use2-az1 &ClientToken=550e8400-e29b-41d4-a716-446655440000 &TagSpecification.1.ResourceType=secondary-subnet &TagSpecification.1.Tag.1.Key=Name &TagSpecification.1.Tag.1.Value=Prod%20Secondary%20Subnet &TagSpecification.1.Tag.2.Key=Environment &TagSpecification.1.Tag.2.Value=Production &AUTHPARAMS

Sample Response

<CreateSecondarySubnetResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/"> <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> <secondarySubnet> <secondarySubnetId>ss-0123456789abcdef0</secondarySubnetId> <secondarySubnetArn>arn:aws:ec2:us-east-2:123456789012:secondary-subnet/ss-0123456789abcdef0</secondarySubnetArn> <secondaryNetworkId>sn-0123456789abcdef0</secondaryNetworkId> <secondaryNetworkType>rdma</secondaryNetworkType> <ownerId>123456789012</ownerId> <availabilityZoneId>use2-az1</availabilityZoneId> <availabilityZone>us-east-2a</availabilityZone> <ipv4CidrBlockAssociations> <item> <associationId>ss-cidr-assoc-56789901234abcdef0</associationId> <cidrBlock>10.0.0.0/24</cidrBlock> <state>associating</state> </item> </ipv4CidrBlockAssociations> <state>create-in-progress</state> <tagSet> <item> <key>Name</key> <value>Prod Secondary Subnet</value> </item> <item> <key>Environment</key> <value>Production</value> </item> </tagSet> </secondarySubnet> <clientToken>550e8400-e29b-41d4-a716-446655440000</clientToken> </CreateSecondarySubnetResponse>

See Also

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