Getting Public IP Addresses

Last updated: 2021-03-22 17:30:49


    This document describes how to obtain the public IP address through console, API, or Instance metadata.


    Obtaining the public IP address on the console

    1. Log in to the CVM Console.
    2. On the instance management page, move the mouse to the primary IP column, and </ img> appears, as shown below:
    3. Click to copy the IP address.


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

    Obtaining the public IP address using API

    Please see DescribeInstances.

    Obtaining the public IP 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. To obtain the public IP address, you can access the metadata by using the cURL tool or an HTTP GET request.
      If the returned value is in the following structure, you can view the public IP address:

      For more information, see Instance Metadata.