Correct answer - "Use EC2 meta data service" : As your instance metadata is available from your
running instance, you do not need to use the Amazon EC2 console or the AWS CLI. This can be
helpful when you're writing scripts to run from your instance. For example, you can access the
local IP address of your instance from instance metadata to manage a connection to an external
application.
Incorrect:
"Attach an IAM role and allow the ec2 describes-instances permission" - Instance metadata is
available from your running instance
"Use EC2 User Data" - Information provided when launching the instance. You do not have control
over providing things that EC2 meta data returns
"Inject that information using AWS Lambda" - Meta data cannot be injected. For example it is not
possible to assign a new custom primary private IP address to an existing instance