AWS Certified Developer – Associate (DVA-C02) — Question 109
A developer deployed an application to an Amazon EC2 instance. The application needs to know the public IPv4 address of the instance.
How can the application find this information?
Answer options
- A. Query the instance metadata from http://169.254.169.254/latest/meta-data/.
- B. Query the instance user data from http://169.254.169.254/latest/user-data/.
- C. Query the Amazon Machine Image (AMI) information from http://169.254.169.254/latest/meta-data/ami/.
- D. Check the hosts file of the operating system.
Correct answer: A
Explanation
The correct answer is A because querying the instance metadata provides access to the public IPv4 address. Option B is incorrect as user data does not contain this information, while option C provides AMI details, not the instance's public IP. Option D is also incorrect since the hosts file does not store the public IP address.