CreateDefaultSubnet
Creates a default subnet with a size /20
IPv4 CIDR block in the
specified Availability Zone in your default VPC. You can have only one default subnet
per Availability Zone. For more information, see Create a default
subnet in the Amazon VPC 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.
- AvailabilityZone
-
The Availability Zone in which to create the default subnet.
Type: String
Required: Yes
- 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 isUnauthorizedOperation
.Type: Boolean
Required: No
- Ipv6Native
-
Indicates whether to create an IPv6 only subnet. If you already have a default subnet for this Availability Zone, you must delete it before you can create an IPv6 only subnet.
Type: Boolean
Required: No
Response Elements
The following elements are returned by the service.
- requestId
-
The ID of the request.
Type: String
- subnet
-
Information about the subnet.
Type: Subnet object
Errors
For information about the errors that are common to all actions, see Common client error codes.
Examples
Example
This example creates a default subnet in Availability Zone
us-east-2a
.
Sample Request
https://ec2.us-east-2.amazonaws.com/?Action=CreateDefaultSubnet
&AvailabilityZone=us-east-2a
&AUTHPARAMS
Sample Response
<CreateDefaultSubnetResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
<requestId>12e2fb2e-e566-488a-926d-4655example</requestId>
<subnet>
<assignIpv6AddressOnCreation>false</assignIpv6AddressOnCreation>
<availabilityZone>us-east-2a</availabilityZone>
<availableIpAddressCount>4091</availableIpAddressCount>
<cidrBlock>172.31.32.0/20</cidrBlock>
<defaultForAz>true</defaultForAz>
<ipv6CidrBlockAssociationSet/>
<mapPublicIpOnLaunch>true</mapPublicIpOnLaunch>
<state>available</state>
<subnetId>subnet-111f7123</subnetId>
<tagSet/>
<vpcId>vpc-8eaaeabc</vpcId>
</subnet>
</CreateDefaultSubnetResponse>
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: