Skip to content

Instantly share code, notes, and snippets.

@nnovzver
Forked from junaidk/ec2.sh
Created June 17, 2018 12:12
Show Gist options
  • Save nnovzver/a4db628561b13978a385692eb60558e5 to your computer and use it in GitHub Desktop.
Save nnovzver/a4db628561b13978a385692eb60558e5 to your computer and use it in GitHub Desktop.
Get List of EC2 instances from All regions
# install aws cli first
for region in `aws ec2 describe-regions --output text | cut -f3`
do
echo -e "\nListing Instances in region:'$region'..."
aws ec2 describe-instances --query "Reservations[*].Instances[*].{IP:PublicIpAddress,ID:InstanceId,Type:InstanceType,State:State.Name,Name:Tags[0].Value}" --output=table --region $region
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment