How to get to know AWS public hostname from EC2 VM ?

[root@ip-172-31-14-108 ec2-user]# curl –write-out “\n” –request GET “http://169.254.169.254/latest/meta-data/public-hostname”
ec2-3-223-194-42.compute-1.amazonaws.com

[root@ip-172-31-14-108 ec2-user]# curl –write-out “\n” –request GET “http://169.254.169.254/latest/meta-data”
ami-id
ami-launch-index
ami-manifest-path
block-device-mapping/
events/
hibernation/
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/
[root@ip-172-31-14-108 ec2-user]#
[root@ip-172-31-14-108 ec2-user]#

  • Ask Question