What would be the best way to retrieve the public IP address of your EC2 instance using the CLI?
What would be the best way to retrieve the public IP address of your EC2 instance using the CLI?
A . Using tags
B . Using traceroute
C . Using ipconfig
D . Using instance metadata
Answer: D
Explanation:
To determine your instance’s public IP address from within the instance, you can use instance metadata.
Use the following command to access the public IP address:
For Linux use, $ curlhttp://169.254.169.254/latest/meta-data/public-ipv4, and for Windows use, $ wget http://169.254.169.254/latest/meta-data/public-ipv4.
Reference: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-instance-addressing.html
Latest AWS-Solution-Architect-Associate Practice Questions with 986 Q&As
Updated Study Material | Instant Download | Detailed Answers and Explanations
Subscribe
Login
0 Comments