Home >Operation and Maintenance >Linux Operation and Maintenance >How to assign a public IP address to an instance

How to assign a public IP address to an instance

坏嘻嘻
坏嘻嘻Original
2018-09-26 11:19:043510browse

This article introduces how to allocate a public IP address to an instance, and focuses on the specific steps. The content of this article is compact, and I hope you can gain something from it.

Description

When calling this interface, you need to pay attention to:

Before assigning a public IP address, the instance must be in Running or Stopped status.

When a VPC type instance has been bound to an EIP, the public IP cannot be allocated.

An instance can only be assigned one public IP address. If the instance already has a public IP address, an AllocatedAlready error will be reported.

After restarting the instance (RebootInstance) or starting the instance (StartInstance), the new public IP address will take effect.

When the OperationLocks of a security-controlled instance is marked with "LockReason" : "security", a public IP address cannot be assigned.

In addition to assigning a public IP, you can also bind an elastic public IP (EIP) to an instance. See AssociateEipAddress for more details.

Request parameters

How to assign a public IP address to an instance

##Return parameters

How to assign a public IP address to an instance

Example

Request Example

https://ecs.aliyuncs.com/?Action=AllocatePublicIpAddress
&InstanceId=i-instance1
&<公共请求参数>

Return example

XML format

<AllocatePublicIpAddressResponse>
    <RequestId>F2EF6A3B-E345-46B9-931E-0EA094818567</RequestId>
    <IpAddress>10.1.149.159</IpAddress>
</AllocatePublicIpAddressResponse>

JSON format

{
    "RequestId": "F2EF6A3B-E345-46B9-931E-0EA094818567",
    "IpAddress": "10.1.149.159"
}

Error code

The following are error codes unique to this interface. For more error codes, please visit the API Error Center.

How to assign a public IP address to an instance

The above is the detailed content of How to assign a public IP address to an instance. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn