How to get the EC2 instance public or private ip address from within an ec2 instance?

You can use AWS EC2 metadata service to get the EC2 instance public or private ip address from within an ec2 instance.
The link to EC2 metadata service is http://169.254.169.254/latest/meta-data/

Leave a Reply