
Answer-first summary for fast verification
Answer: Query the metadata at http://169.254.169.254/latest/meta-data
Query the metadata at http://169.254.169.254/latest/meta-data - Because 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. To view all categories of instance metadata from within a running instance, use the following URI - http://169.254.169.254/latest/meta-data/. The IP address 169.254.169.254 is a link-local address and is valid only from the instance. All instance metadata is returned as text (HTTP content type text/plain). Incorrect options: Create an IAM role and attach it to your EC2 instance that helps you perform a 'describe' API call - The AWS CLI has a describe-instances API call needs instance ID as an input. So, this will not work for the current use case wherein we do not know the instance ID. Query the user data at http://169.254.169.254/latest/user-data - This address retrieves the user data that you specified when launching your instance. Query the user data at http://254.169.254.169/latest/meta-data - The IP address specified is wrong.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
You have been tasked with managing an AWS environment and are currently using a t2.small instance configured as a bastion host. This bastion host has the AWS CLI installed, allowing you to manage various AWS services directly from the instance. Your goal is to obtain the security group and instance ID of this specific bastion host instance.
Which of the following commands will enable you to retrieve the necessary information?
A
Query the metadata at http://169.254.169.254/latest/meta-data
B
Query the user data at http://254.169.254.169/latest/meta-data
C
Create an IAM role and attach it to your EC2 instance that helps you perform a 'describe' API call
D
Query the user data at http://169.254.169.254/latest/user-data
No comments yet.