This operation allows you to assign an available Internet IP address to a given instance. When allocating Internet IP addresses, consider the following:
- For the APIs for Elastic IP (EIP) addresses, refer to Query the list of EIPs.
- This interface can only be invoked when the instance is in Running or Stopped status.
- The allocated IP address only takes effect after the instance is started or restarted.
- You can only assign an IP, not an IP segment.
- Only one IP address can be allocated to one instance. If the instance already has an Internet IP address, when the interface is invoked, the original IP address is directly returned.
OperationLocksof the instance indicates
LockReason: security, the Internet IP address cannot be assigned.
|Action||String||Yes||To allocate and Internet IP. Value: AllocatePublicIpAddress.|
|InstanceId||String||Yes||Indicates the ID of the instance to be assigned an Internet IP address.|
|IpAddress||String||Indicates the assigned Internet IP address.|
|Error code||Description||HTTP status codeHttp||Meaning|
|MissingParameter||The input parameter InstanceId that is mandatory for processing this request is not supplied.||400||The InstanceId value is missing.|
|AllocatedAlready||There is an IpAddress allocated already for the specified instance.||403||When the user attempts to bind the specified IP address, it is found that another IP address has been assigned to the instance.|
|IncorrectInstanceStatus||The current status of the resource does not support this operation.||403||The current status of the resource does not support this operation.|
|InstanceExpiredOrInArrears||The specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode).||403||The instance expires (on a yearly or monthly basis) or is in overdue payment (based on traffic).|
|InstanceLockedForSecurity||The specified operation is denied as your instance is locked for security reasons.||403||The operation is denied because the resource is locked for security reasons.|
|IpInUse||The specified IP is already in use.||403||When the user attempts to bind the specified IP address, it is found that the specified IP address is already in use elsewhere.|
|InvalidInstanceId.NotFound||The specified InstanceId does not exist.||404||The specified InstanceId does not exist.|
&<Public Request Parameters>