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

前端 未结 17 1247
囚心锁ツ
囚心锁ツ 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:13

    You may use cli tool designed for enumerating cloud resources (cross-region and cross-accounts scan) - https://github.com/scopely-devops/skew

    After short configuration you may use the following code for list all instances in all US AWS regions (assuming 123456789012 is your AWS account number).

    from skew import scan
    
    arn = scan('arn:aws:ec2:us-*:123456789012:instance/*')
    for resource in arn:
        print(resource.data)
    

提交回复
热议问题