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

坏嘻嘻
Release: 2018-09-26 11:19:04
Original
3511 people have browsed it

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
&<公共请求参数>
Copy after login

Return example

XML format

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

JSON format

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template