How to retrieve EC2 Instance meta information

4/1/2020·1 min read

SSH into EC2 instance

To retrieve EC2 instance meta information, once SSH into EC2 instance type following command.

run with root privileges


sudo su

list all the metadata


curl http://169.254.169.254/latest/meta-data

Get EC2's hostname


curl http://169.254.169.254/latest/meta-data/local-hostname

Get EC2's user data


curl http://169.254.169.254/latest/user-data