Obtaining a Public IP Address of the Instance

Last updated: 2018-06-27 10:43:21

PDF

Obtaining the Address on the Console

  1. Log in to the CVM Console.
  2. The CVM list displays the instances under your account. Move the mouse cursor over the public IP of the CVM, and the "Copy" button will appear. Click the button to copy this IP address.

Note:
The public IP address is mapped to the private IP address through NAT. Therefore, if you view the attributes of a network interface within the instance (for example, by using the commands such as ifconfig (Linux) or ipconfig (Windows)), the public IP address is not displayed. To obtain the public IP address of an instance from within the instance, please see Obtain the Public IP Address of an Instance Using Instance Metadata.

Obtaining the Address Using API

&Nbsp;     For more information, please see DescribeInstances API.

Obtaining the Address Using Instance Metadata

  1. Log in to the CVM instance. For more information, please see Log in to Linux Instance and Log in to Windows Instance.
  2. Enter the command:
curl http://metadata.tencentyun.com/meta-data/public-ipv4

If the returned value is in the following structure, you can see the public IP address:

For more information, please see Instance Metadata.