What specific syntax can be used to return the private IP address of an Amazon Linux EC2 instance from the command line within that instance?
So far, I have come up with the following:
# Get private IP from inside the instance by filtering inside the following: instanceid=$(curl http://169.254.169.254/latest/meta-data/instance-id) echo $instanceid aws ec2 describe-instances --instance-id $instanceid --region us-west-2
However, as you can see if you type these commands inside an EC2 instance yourself, the above 3 lines result in a massive output, which would be a mess to filter through manually.
Can someone suggest one or two lines of code to return simply the private ip of the instance and NO other information?