Aws Cli Find All Instances In All Regions

less than 1 minute read

Lists all ec2 instances in all regions including account owner, instance id, instance type, statues and region.


for region in `aws ec2 describe-regions --output text | cut -f3`; do
    echo -e "\nInstances in: '$region':";
    aws ec2 describe-instances --query 'Reservations[*].Instances[*].[NetworkInterfaces[0].OwnerId, Placement.AvailabilityZone, VpcId, InstanceId, InstanceType, State.Name]' --output text --region ${region};
done;

Comments