AWS Certified SysOps Administrator – Associate (legacy) — Question 413
How can software determine the public and private IP addresses of the Amazon EC2 instance that it is running on?
Answer options
- A. Query the local instance metadata.
- B. Query the appropriate Amazon CloudWatch metric.
- C. Query the local instance userdata.
- D. Use ipconfig or ifconfig command.
Correct answer: A
Explanation
Amazon EC2 instance metadata contains configuration data about the running instance, including public and private IP addresses, which can be retrieved via a local HTTP request to the link-local address 169.254.169.254. Local OS commands like ipconfig or ifconfig will not show the public IP address because the instance operates behind a Network Address Translation (NAT) barrier. Amazon CloudWatch metrics monitor performance data rather than configuration details, and instance userdata is primarily used for bootstrap scripts.