How to get Ec2 instace Public IP address from AWS cli

Run command to get Ec2 Public IP address from CLI
aws ec2 describe-instances --query 'Reservations[*].Instances[*].PublicIpAddress' --output text

Check Public IP address of running Ec2 instance
aws ec2 describe-instances --filters Name=instance-state-name,Values=running --output json | jq -r .Reservations[].Instances[].PublicIpAddress
Share on Google Plus

About Penguin Technology

I am a passionate cloud and DevOps professional specializing in Linux and open-source solutions. Through this blog, I share my knowledge and experience with the community, offering tips and insights on cloud technologies and DevOps practices.
    Blogger Comment

3 comments: