How to list every running EC2 instance across all AWS regions

Updated · 4 min read

The EC2 console lists the servers in one region: whichever is picked at the top right. A server someone launched in Oregon while you're looking at Ohio just isn't on the page, and it bills by the second all the same. Here's how to see all of them at once.

In the AWS console

  • EC2 Global View. Type "EC2 Global View" into the search bar at the top of the console. The Region explorer tab counts your instances, volumes, security groups and more in every region, so a region with a forgotten server stands out. The Global search tab lists the resources themselves across regions; choose an instance ID to open it in its own region.
  • Tag Editor. Open Resource Groups & Tag Editor → Tag Editor, set Regions to All regions and Resource types to AWS::EC2::Instance, and click Search resources. You get every instance with its region and tags, but not whether it's running.

Once you know the regions, open EC2 → Instances in each one and filter on Instance state = running to see what's actually on.

With the AWS CLI

Every running instance, in every region your account has turned on:

for region in $(aws ec2 describe-regions --query 'Regions[].RegionName' --output text); do
  aws ec2 describe-instances --region "$region" \
    --filters Name=instance-state-name,Values=running \
    --query 'Reservations[].Instances[].[InstanceId, InstanceType, LaunchTime, Tags[?Key==`Name`].Value | [0]]' \
    --output text | awk -v r="$region" '{print r "\t" $0}'
done

Each line is the region, the instance ID, its type, when it was last started and its name (None if it has no Name tag). LaunchTime is the most recent start, not when the server was created.

To include stopped servers too, which still cost money (see below), use Values=running,stopped and add State.Name to the list in --query.

Just a count per region:

for region in $(aws ec2 describe-regions --query 'Regions[].RegionName' --output text); do
  echo "$region $(aws ec2 describe-instances --region "$region" \
    --filters Name=instance-state-name,Values=running \
    --query 'length(Reservations[].Instances[])')"
done

describe-regions returns only the regions turned on for your account, which are the only ones that can have servers in them. You need ec2:DescribeInstances and ec2:DescribeRegions; AWS's ReadOnlyAccess policy has both.

Stopped isn't free

Stopping a server ends the charge for its compute time. Each start is billed for at least a minute, then by the second. Its disks (EBS volumes) are still billed while it's stopped, and so is an Elastic IP attached to it. Its automatic public IP address is released when it stops, and it gets a new one when it starts.

To stop a server, or to terminate one you don't need any more:

aws ec2 stop-instances --region us-west-2 --instance-ids i-0123456789abcdef0
aws ec2 terminate-instances --region us-west-2 --instance-ids i-0123456789abcdef0

Terminating deletes the boot disk by default, but extra disks are often kept (it depends on how they were attached), and a kept disk keeps billing. Afterwards, look in EC2 → Volumes for any marked Available.

Three things that catch people out:

  • It comes back. A server in an Auto Scaling group is replaced when you stop or terminate it. Set the group's desired capacity to 0, or delete the group.
  • It won't terminate. Termination protection is on. Turn it off in the instance's settings first.
  • It's not in EC2 at all. Lightsail servers have their own console and never appear in EC2.

Or in Cloud GUI

Cloud GUI's Servers page lists every EC2 instance in every region turned on in your account, in one table: name and instance ID, state, type, region, IP address and when it last started, with a summary like "12 servers, 4 running · in 3 of your 17 regions". The filter box matches names and IDs. Open a server to see its CPU use over the last 24 hours (one idling near 0% is a candidate for stopping), its status checks, disks, network and firewall rules. On Pro, with editing turned on, you can start, stop and reboot servers from there; stop and reboot ask you to type the server's name first. It can't terminate servers. The free checkup also finds disks not attached to any server and Elastic IPs not in use, in every region, with roughly what each costs a month.

See your whole AWS account in one calm view

Cloud GUI shows your files and functions from every region at once, in plain English, with what's failing up front. It connects with a read-only role you create and can delete any time. Free for one AWS account.

More guides

Free tool
IAM policy explainer

Paste an IAM policy and read it in plain English, with the risky parts flagged. It runs in your browser; nothing is sent anywhere.