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

Steps to create a Vite project

Table of contents Preface What does yarn create d...

A complete tutorial on using axios encapsulation in vue

Preface Nowadays, in projects, the Axios library ...

VMware virtual machine installation Linux system graphic tutorial

This article shares the specific steps of VMware ...

Detailed explanation of the mechanism and implementation of accept lock in Nginx

Preface nginx uses a multi-process model. When a ...

Example of using CSS3 to create Pikachu animated wallpaper

text OK, next it’s time to show the renderings. O...

IIS and APACHE implement HTTP redirection to HTTPS

IIS7 Download the HTTP Rewrite module from Micros...

Detailed explanation of MySQL redo log (redo log) and rollback log (undo logo)

Preface: The previous article described several c...

dl, dt, dd list label examples

The dd and dt tags are used for lists. We usually...

Vue implements a movable floating button

This article example shares the specific code of ...

Record a pitfall of MySQL update statement update

background Recently, I executed a DML statement d...

Detailed explanation of how to use the Vue license plate search component

A simple license plate input component (vue) for ...

Navicat for MySQL scheduled database backup and data recovery details

Database modification or deletion operations may ...

Mysql dynamically updates the database script example explanation

The specific upgrade script is as follows: Dynami...

1 minute Vue implements right-click menu

Table of contents Rendering Install Code Implemen...

Steps to package and release the Vue project

Table of contents 1. Transition from development ...