Getting Public IP Addresses

Last updated: 2025-04-29 09:18:12

Scenario

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

Instructions

Acquiring via the console
Acquiring through APIs
Obtaining through instance metadata
1. Log in to the CVM console.
2. On the Instance console management page, proceed according to the used view mode:
List View: Hover over the Primary IPv4 Address column and click

to copy the IP address, as shown below:

Tab View: On the instance page, click

after the public address in IP Address to copy the public IP. As shown in the figure:


Note
Since the public IP address is mapped to the private IP address through NAT, you will not see the public IP address when viewing the network interface properties within the instance (e.g., using ifconfig (Linux) or ipconfig (Windows) commands). To determine the public IP address of the instance from within the instance, refer to Obtaining via Instance Metadata.

Please refer to the DescribeDBLogFiles related interface.
1.
Log in to the CVM instance
. For specific login methods, refer to Logging in to Linux Instance and Logging 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.
curl http://metadata.tencentyun.com/meta-data/public-ipv4
If the returned value is in the following structure, you can view the public IP address:



For more information, see Querying Instance Metadata.