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

前端 未结 17 1253
囚心锁ツ
囚心锁ツ 2021-01-29 23:03

I switch instances between different regions frequently and sometimes I forget to turn off my running instance from a different region. I couldn\'t find any way to see all the r

17条回答
  •  粉色の甜心
    2021-01-29 23:09

    A quick bash oneliner command to print all the instance IDs in all regions:

    $ aws ec2 describe-regions --query "Regions[].{Name:RegionName}" --output text |xargs -I {} aws ec2 describe-instances --query Reservations[*].Instances[*].[InstanceId] --output text --region {}
    
    # Example output
    i-012344b918d75abcd
    i-0156780dad25fefgh
    i-0490122cfee84ijkl
    ...
    

提交回复
热议问题