CreateSubnet
In this article:
CreateSubnet#
Description#
Creates a subnet in an existing VPC.
Request Parameters#
Required parameters#
CidrBlock — The network range for the subnet, in CIDR notation (X.X.X.X/Y). It must be within the CIDR range of the specified VPC.
Required: Yes
Type: String
VpcId — The ID of the VPC.
Required: Yes
Type: String
Optional parameters#
AvailabilityZone — The availability zone name.
Required: No
Type: String
Valid values:
ru-msk-comp1p
|ru-msk-vol51
|ru-msk-vol52
TagSpecification.N — The tags assigned to the resource when it is created.
Type: List of TagSpecification objects
Required: No
Response Elements#
requestId — The request ID.
Type: String
subnet — Information about the subnet.
Type: Subnet object
Examples#
c2-ec2 CreateSubnet VpcId <vpc_id> CidrBlock 10.10.10.0/24
c2-ec2 CreateSubnet VpcId <vpc_id> CidrBlock 10.10.10.0/24 AvailabilityZone ru-msk-comp1p
c2-ec2 CreateSubnet VpcId <vpc_id> CidrBlock 10.10.10.0/24 TagSpecification.0.ResourceType subnet \
TagSpecification.0.Tag.0.Key "tag_key" TagSpecification.0.Tag.0.Value "tag_value"