How do you check the public IP of a host and the metadata that explains it?
BeginnerConceptCommand-Line Tools & Diagnostics
Answer
curl -s https://checkip.amazonaws.com
curl -s -H "X-aws-ec2-metadata-token: $(curl -s -X PUT http://169.254.169.254/latest/api/token -H 'X-aws-ec2-metadata-token-ttl-seconds: 60')" http://169.254.169.254/latest/meta-data/public-ipv4
The first shows the egress address the world sees (a NAT gateway's EIP for private instances), the second the instance's own assigned public IP.
More on Command-Line Tools & Diagnostics
How do you check if a remote port is open?BeginnerHow do you list listening ports and the processes that own them?BeginnerWhat does `ping` tell you and what does it not?BeginnerHow does traceroute work and how do you read the output?BeginnerWhat is mtr and why is it better than traceroute?IntermediateHow do you query DNS with dig and read the answer?Beginner