Obtaining a Public IP Address of the Instance
Last updated: 2020-02-02 19:29:32PDF
You can get public IP through console, API, or Instance Metadata.
Obtaining the Address on the Console
- Log in to the CVM Console.
- 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
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
- Log in to the CVM instance. For more information, please see Log in to Linux Instance and Log in to Windows Instance.
- Enter the command:
If the returned value is in the following structure, you can see the public IP address:
For more information, please see Instance Metadata.