The EC2 instance metadata is the data about your running instance, which can be accessed within the instance itself. This instance data is very useful when you need some details programmatically, such as an instance ID, public IP or private IP, and so on. You can also access user data using the instance metadata that you supply at the time of the EC2 instance launch. You can use the following URL to view all the categories of the instance metadata from within a running instance:
http://169.254.169.254/latest/meta-data/
You can use a tool such as curl to access the instance metadata:
curl http://169.254.169.254/latest/meta-data/
These are some of the examples of the instance metadata that you can use:
The user metadata can be accessed using the following command:
curl http://169.254.169.254/latest/user-data