AssociateVpcSubnet
AssociateVpcSubnet
Last updated
AssociateVpcSubnet
Last updated
This API is used to add a subnet into a VPC.
Note
This API is an async API. A request ID is returned after the request is sent. However, it does not mean the binding has been completed. You can use DescribeSubnets
to query the status.
Only operations on instances in RUNNING
status are supported.
CIDR block of the subnet should be in the range of VPC CIDR block and not overlap with IP ranges of other subnets in this VPC.
Zone of the subnet should be in the availability region of the VPC. You can call DescribeVpcAvailableRegions
to check the zones in the availability region.
No action will be made against the subnet already in the VPC.
Both the status of VPC and subnet should be AVAILABLE.
The following request parameter list only provides API request parameters.
Parameter Name | Required | Type | Description |
---|---|---|---|
Parameter Name | Type | Description |
---|---|---|
Add a subnet into a VPC.
Zenlayer Cloud API 2.0 integrates SDKs to make it easier for you to call APIs. More programming languages will be supported.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
HTTP Status Code | Error Code | Description |
---|---|---|
subnetId
Yes
String
Subnet ID.
vpcId
Yes
String
VPC ID.
requestId
String
The unique request ID, which is returned for each request. RequestId is required for locating a problem.
404
INVALID_VPC_NOT_FOUND
VPC not found.
404
INVALID_SUBNET_NOT_FOUND
Subnet not found.
403
OPERATION_DENIED_SUBNET_STATUS_NOT_SUPPORT
Subnet status not supported.
403
OPERATION_DENIED_SUBNET_ASSOCIATED_OTHER_VPC
Subnet is in other VPC.
403
OPERATION_DENIED_VPC_STATUS_NOT_SUPPORT
VPC status not supported.
403
OPERATION_DENIED_NO_AVAILABLE_VPC_REGION
Invalid availability region ID of VPC.
403
OPERATION_DENIED_ZONE_NOT_BELONG_VPC
Zone of subnet does not belong to the availability region of VPC.
403
OPERATION_DENIED_VPC_ZONE_SUBNET_EXCEED_LIMIT
Quantity of subnets exceeds the limit of the zone.
400
INVALID_PARAMETER_VPC_SUBNET_OVER_LAP
Overlapped CIDR blocks of subnets in VPC.