Amazon EC2 取得自己的外部IP和域名

保存到临时文件

wget -q -O /tmp/public-ip http://169.254.169.254/latest/meta-data/public-ipv4
wget -q -O /tmp/public-hostname http://169.254.169.254/latest/meta-data/public-hostname

 

直接查看

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

 

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

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

你可能感兴趣的:(Amazon EC2 取得自己的外部IP和域名)