AWS Certified Developer Associate (#12)

A Developer is creating an application that needs to locate the public IPv4 address of the Amazon EC2 instance on which it runs. How can the application locate this information?

Get the instance metadata by retrieving http://169.254.169.254/latest/metadata/.
Get the instance user data by retrieving http://169.254.169.254/latest/userdata/.
Get the application to run IFCONFIG to get the public IP address.
Get the application to run IPCONFIG to get the public IP address.