I have an instance that I start through aws cli:
aws ec2 start-instances --instance-ids i-00112223333444445
Instance does not have a static public IP. How can I get instance public ip through CLI knowing the ID i-00112223333444445?
Try the following command:
aws ec2 describe-instances --instance-ids $instance_id \
    --query 'Reservations[*].Instances[*].PublicIpAddress' \
    --output text
If the EC2 instance has a public IP address, this command will return it.
Links:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With