AssociateSubnetInstances
AssociateSubnetInstances
1. API Description
This API is used to add one or more instances into a subnet and assign private IPs to instances.
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 ofprivateIpStatus
.If the status is
BINDED
, it means that the private IP has been bound.If the status is
BINDING
, it means that the private IP is being bound.If the status is
UNBINDING
, it means that the private IP is being unbound.
Only operations on instances in
RUNNING
status are supported.Instances can only be added into the subnet in the same zone.
The status of subnet should be AVAILABLE and there are still available private IPs in it.
Generally, an instance can only be added into one subnet. If the instance is already in other subnet, the request will fail. However, if you do need to add one instance into two or more subnets, please contact Zenlayer Support.
Batch operations are supported. Each request can add up to 100 instances.
2. Input Parameters
The following request parameter list only provides API request parameters.
subnetId
Yes
String
Subnet ID.
3. Output Parameters
requestId
String
The unique request ID, which is returned for each request. RequestId is required for locating a problem.
4. Code Example
Add instance into a subnet and assign a private IP to it.
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.
403
OPERATION_DENIED_INSTANCE_NOT_SUPPORT_SUBNET
Operations on adding the instance into a subnet not supported.
403
OPERATION_DENIED_INSTANCE_NOT_RUNNING
Only operations on instances in RUNNING
status are supported.
404
INVALID_SUBNET_NOT_FOUND
Subnet not found.
403
OPERATION_DENIED_SUBNET_STATUS_NOT_SUPPORT
Subnet status not supported.
403
OPERATION_DENIED_DIFFERENT_ZONE
Instances can only be added into the subnet in the same zone.
403
OPERATION_DENIED_SUBNET_EXIST_INSTANCE
Instance already exists in the subnet.
400
INVALID_PARAMETER_DUPLICATE_LAN_IP
Duplicated private IPs assigned to instances.
400
INVALID_PARAMETER_LAN_IP_NOT_SUPPORT
Private IP ended with .1 cannot be assigned.
403
OPERATION_DENIED_IP_ASSOCIATED_INSTANCE
Unavailable private IP. This has already been assigned to an instance.
403
OPERATION_DENIED_SUBNET_NOT_REPEAT_INSTANCE
Duplicated instances in the subnet.
Last updated