CreateSubnet

CreateVpc

1. API Description

This API is used to create a subnet.

Prerequisites

Before creating a subnet, call DescribeSubnetAvailableResources to check the zones available for subnet creation.

Note

  • The quantity of subnets you can create in one zone is limited. If you need more, please contact Zenlayer Support.

  • Create a subnet separately if you need a Layer 2 network; create subnets in a VPC if you need a Layer 3 network. You are recommended to create subnets in a VPC because they can communicate with each other. You can also create a subnet separately and then upgrade it into a VPC.

  • This API is an async API. A subnet ID list is returned after the creation request is sent. However, it does not mean the creation has been completed. The status of the subnet will be CREATING during the creation. You can use DescribeSubnets to query the status of the subnet. If the status changes from Creating to Available, it means that the subnet has been created successfully; CREATE_FAILED means the subnet has been created failed. Any operations on the subnets are not allowed while creating.

2. Input Parameters

The following request parameter list only provides API request parameters.

3. Output Parameters

4. Code Example

Create a subnet in zone SIN-B.

POST /api/v2/bmc HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: CreateSubnet
<Common Request Params>

Request:
{
  "zoneId": "SIN-B",
  "cidrBlock": "10.0.0.0/16",
  "subnetName": "Subnet-Test-alict"
}

Response:
{
  "requestId": "T39EC84B4-63B4-409E-A09D-F052434DF276",
  "response": {
    "requestId": "T39EC84B4-63B4-409E-A09D-F052434DF276",
    "subnetId": "832999436413042904"
  }
}

5. Developer Resources

Zenlayer Cloud API 2.0 integrates SDKs to make it easier for you to call APIs. More programming languages will be supported.

6. Error Codes

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.​

Last updated