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.

Response Elements#

  • requestId — The request ID

    • Type: String

  • subnet — Information about the subnet.


c2-ec2 CreateSubnet VpcId <vpc_id> CidrBlock

c2-ec2 CreateSubnet VpcId <vpc_id> CidrBlock AvailabilityZone ru-msk-comp1p

c2-ec2 CreateSubnet VpcId <vpc_id> CidrBlock TagSpecification.0.ResourceType subnet \
                    TagSpecification.0.Tag.0.Key "tag_key" TagSpecification.0.Tag.0.Value "tag_value"