DEV Community

Cover image for How To List All Enabled Regions Within An AWS account
๐Ÿš€ Vu Dao ๐Ÿš€
๐Ÿš€ Vu Dao ๐Ÿš€

Posted on • Edited on

How To List All Enabled Regions Within An AWS account

Ref: describe-regions

If the Region is enabled by default, the output includes the following:

"OptInStatus": "opt-in-not-required"

If the Region is not enabled, the output includes the following:

"OptInStatus": "not-opted-in"

After an opt-in Region is enabled, the output includes the following:

"OptInStatus": "opted-in"

Pre-required:

  1. AWS CLI
  2. jq JSON Alt Text

Run



aws ec2 describe-regions --all-regions | jq -r '.Regions | .[] | .RegionName + " " + .OptInStatus'  | grep -v not-opted-in | cut -d' ' -f1
eu-north-1                     
ap-south-1                       
eu-west-3                    
eu-west-2      
eu-west-1             
ap-northeast-2           
me-south-1        
ap-northeast-1                                     
sa-east-1                                             
ca-central-1                                 
ap-east-1                                                                                                                                    
ap-southeast-1                          
ap-southeast-2                                 
eu-central-1                               
us-east-1       
us-east-2    
us-west-1    
us-west-2


Enter fullscreen mode Exit fullscreen mode

Top comments (0)