1. 程式人生 > >Amazon EC2 取得自己的外部IP和域名

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