|« PreviousNext »|
|Did this page help you? Yes | No | Tell us about it...|
Creates a subnet in an existing VPC. You can create up to 20 subnets in a VPC. If you add more than one subnet to a VPC, they're set up in a star topology with a logical router in the middle. If you need more than 20 subnets, you can request more by going to Request to Increase Amazon VPC Limits.
When you create each subnet, you provide the VPC ID and the CIDR block you want for the subnet. After you create a subnet, you can't change its CIDR block. The subnet's CIDR block can be the same as the VPC's CIDR block (assuming you want only a single subnet in the VPC), or a subset of the VPC's CIDR block. If you create more than one subnet in a VPC, the subnets' CIDR blocks must not overlap. The smallest subnet (and VPC) you can create uses a /28 netmask (16 IP addresses), and the largest uses a /16 netmask (65,536 IP addresses).
AWS reserves both the first four and the last IP address in each subnet's CIDR block. They're not available for use.
If you launch an instance in a VPC using an Amazon EBS-backed AMI, the IP address doesn't change if you stop and restart the instance (unlike a similar instance launched outside a VPC, which gets a new IP address when restarted). It's therefore possible to have a subnet with no running instances (they're all stopped), but no remaining IP addresses available. For more information about Amazon EBS-backed AMIs, see AMI Basics in the Amazon Elastic Compute Cloud User Guide.
The ID of the VPC.
The CIDR block for the subnet. For example,
The Availability Zone for the subnet.
Default: AWS selects a zone for you (recommended)
The following elements are returned in a
The ID of the request.
Information about the subnet.
This example creates a subnet with CIDR block 10.0.1.0/24 in the VPC with ID vpc-1a2b3c4d.
https://ec2.amazonaws.com/?Action=CreateSubnet &VpcId=vpc-1a2b3c4d &CidrBlock=10.0.1.0/24 &AUTHPARAMS
<CreateSubnetResponse xmlns="http://ec2.amazonaws.com/doc/2013-02-01/"> <requestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</requestId> <subnet> <subnetId>subnet-9d4a7b6c</subnetId> <state>pending</state> <vpcId>vpc-1a2b3c4d</vpcId> <cidrBlock>10.0.1.0/24</cidrBlock> <availableIpAddressCount>251</availableIpAddressCount> <availabilityZone>us-east-1a</availabilityZone> <tagSet/> </subnet> </CreateSubnetResponse>