
Answer-first summary for fast verification
Answer: By accessing instance metadata from the designated URL.
The correct answer is A. The application can retrieve its public IPv4 address by accessing the instance metadata from the URL http://169.254.169.254/latest/meta-data/. This metadata service includes various details about the instance, such as its public IPv4 address, which can be specifically retrieved from http://169.254.169.254/latest/meta-data/public-ipv4. Option B relates to user data, which typically contains instance-specific scripts and data that can be used during the instance's initialization, and not its IP address. Option C mentions AMI information, which pertains to the Amazon Machine Image used to launch the instance and does not hold the instance's runtime metadata like its public IP. Option D involves checking the operating system configuration, which is not a reliable method to directly obtain the public IPv4 address of an EC2 instance.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
How can an application deployed on an Amazon EC2 instance retrieve its public IPv4 address?
A
By accessing instance metadata from the designated URL.
B
By accessing instance user data from the designated URL.
C
By accessing Amazon Machine Image (AMI) information from the designated URL.
D
By checking the instance's operating system configuration.
No comments yet.