I have name of the a ec2 instance and want to do ssh to it. How can I figure out the ‘Public DNS’ of the ec2 instance using the ec2 instance name.
I want to do it using bash.
aws ec2 describe-instances --instance-ids i-12abc34 --query 'Reservations.Instances.PublicDnsName'
Where i-12abc34 is your instance id