Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to see all running Amazon EC2 instances across all regions?

People also ask

Are EC2 instances global?

Amazon EC2 now offers Global View on the console to view all resources across regions together. You can now view your AWS resources such as Instances, VPCs, Subnets, Security Groups, Volumes across AWS Regions.


Nov 2021 Edit: AWS has recently launched the Amazon EC2 Global View with initial support for Instances, VPCs, Subnets, Security Groups and Volumes.

See the announcement or documentation for more details


A non-obvious GUI option is the Tag Editor in the Resource Groups console. Here you can find all instances across all regions, even if the instances were not tagged. Screen capture of


I don't think you can currently do this in the AWS GUI. But here is a way to list all your instances across all regions with the AWS CLI:

for region in `aws ec2 describe-regions --region us-east-1 --output text | cut -f4`
do
     echo -e "\nListing Instances in region:'$region'..."
     aws ec2 describe-instances --region $region
done

Taken from here (If you want to see full discussion)

Also, if you're getting a

You must specify a region. You can also configure your region by running "aws configure"

You can do so with aws configure set region us-east-1, thanks @Sabuncu for the comment.

Update

Now (in 2019) the cut command should be applied on the 4th field: cut -f4


In Console

Go to VPC dashboard https://console.aws.amazon.com/vpc/home and click on Running instances -> See all regions.

enter image description here

In CLI

Add this for example to .bashrc. Reload it source ~/.bashrc, and run it

Note: Except for aws CLI you need to have jq installed

function aws.print-all-instances() {
  REGIONS=`aws ec2 describe-regions --region us-east-1 --output text --query Regions[*].[RegionName]`
  for REGION in $REGIONS
  do
    echo -e "\nInstances in '$REGION'..";
    aws ec2 describe-instances --region $REGION | \
      jq '.Reservations[].Instances[] | "EC2: \(.InstanceId): \(.State.Name)"'
  done
}

Example output:

$ aws.print-all-instances 

Listing Instances in region: 'eu-north-1'..
"EC2: i-0548d1de00c39f923: terminated"
"EC2: i-0fadd093234a1c21d: running"

Listing Instances in region: 'ap-south-1'..

Listing Instances in region: 'eu-west-3'..

Listing Instances in region: 'eu-west-2'..

Listing Instances in region: 'eu-west-1'..

Listing Instances in region: 'ap-northeast-2'..

Listing Instances in region: 'ap-northeast-1'..

Listing Instances in region: 'sa-east-1'..

Listing Instances in region: 'ca-central-1'..

Listing Instances in region: 'ap-southeast-1'..

Listing Instances in region: 'ap-southeast-2'..

Listing Instances in region: 'eu-central-1'..

Listing Instances in region: 'us-east-1'..

Listing Instances in region: 'us-east-2'..

Listing Instances in region: 'us-west-1'..

Listing Instances in region: 'us-west-2'..

  1. First go to AWS Management console and click on Resource group:

    enter image description here

  2. Then find Network and Content Delivery and click on the VPC:

    enter image description here

  3. Then find Running instances and expand see all regions. Here you can find all the running instances of all region:

    enter image description here


@imTachu solution works well. To do this via the AWS console...

  • AWS console
  • Services
  • Networking & Content Delivery
  • VPC
  • Look for a block named "Running Instances", this will show you the current region
  • Click the "See all regions" link underneath

Every time you create a resource, tag it with a name and now you can use Resource Groups to find all types of resources with a name tag across all regions.


After reading through all the solutions and trying bunch of stuff, the one that worked for me was-

  1. List item
  2. Go to Resource Group
  3. Tag Editor
  4. Select All Regions
  5. Select EC2 Instance in resource type
  6. Click Search Resources

Snapshot of the solution