How to assign a public IP address to an instance in Linux

How to assign a public IP address to an instance in Linux

describe

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

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

If an EIP is bound to a VPC instance, a public IP address cannot be assigned to it.

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

After you restart the instance (RebootInstance) or start the instance (StartInstance), the new public IP address takes effect.

If 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 address, you can also bind an Elastic IP address (EIP) to an instance. For more details, see AssociateEipAddress.

Request Parameters

Return Parameter

Example

Request Example

https://ecs.aliyuncs.com/?Action=AllocatePublicIpAddress

&InstanceId=i-instance1

&<Common request parameters>

Return to 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 specific to this interface. For more error codes, please visit the API Error Center.

The above is the details of how to assign a public IP address to an instance. Thank you for your support of 123WORDPRESS.COM.

You may also be interested in:
  • How to obtain the local public IP address in linux c

<<:  How to use lodop print control in Vue to achieve browser compatible printing

>>:  Some notes on mysql create routine permissions

Recommend

How to enhance Linux and Unix server security

Network security is a very important topic, and t...

mysql5.7.22 download process diagram

1. Go to the official website www.mysql.com and s...

JavaScript implements countdown on front-end web page

Use native JavaScript to simply implement the cou...

Linux system MySQL8.0.19 quick installation and configuration tutorial diagram

Table of contents 1. Environment Introduction 2. ...

How to check whether a port is occupied in LINUX

I have never been able to figure out whether the ...

How to configure anti-hotlinking for nginx website service (recommended)

1. Principle of Hotlinking 1.1 Web page preparati...

How to run nginx in Docker and mount the local directory into the image

1 Pull the image from hup docker pull nginx 2 Cre...

Analysis of the principles and usage of Linux hard links and soft links

In the Linux system, there is a kind of file call...

Use Xshell to connect to the Linux virtual machine on VMware (graphic steps)

Preface: I recently started to study the construc...

uniapp dynamic modification of element node style detailed explanation

Table of contents 1. Modify by binding the style ...