Obtaining a Public IP Address of the Instance

Last updated: 2020-02-02 19:29:32



You can get public IP through console, API, or Instance Metadata.


Obtaining the Address on the Console

  1. Log in to the CVM Console.
  2. For each instance, there is an copy icon for an IP address. Click the button to copy this IP address.

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.