#Execute below command to get meta data
# Lấy Token để truy xuất
TOKEN=`curl -X PUT "<http://169.254.169.254/latest/api/token>" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"`
# Dùng Token để truy xuất vào
curl -H "X-aws-ec2-metadata-token: $TOKEN" -v <http://169.254.169.254/latest/meta-data/>
1 số thông tin có thể truy xuất
ami-id ami-launch-index ami-manifest-path block-device-mapping/ events/ hostname identity-credentials/ instance-action instance-id instance-life-cycle instance-type local-hostname local-ipv4 mac metrics/ network/ placement/ profile public-hostname public-ipv4 public-keys/ reservation-id security-groups services/
⇒ Giúp truy xuất vào Data

⇒ Lấy ra Token

⇒ Truy xuất vào địa chỉ 169.254.169.254/latest/meta-data
Xem bên trong:
curl -H "X-aws-ec2-metadata-token: $TOKEN" -v <http://169.254.169.254/latest/meta-data/public-ip4>

18.136.118.87

⇒ Nó chính là my-first-ec2
curl -H "X-aws-ec2-metadata-token: $TOKEN" -v <http://169.254.169.254/latest/meta-data/public-ip4>

ami-05f071c65e32875a8