Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using aws cli, what is best way to determine the current region

Interactively, I can use "aws configure" to change or see the default region. Is there a "pwd" like function, documented or not that allows me to determine or confirm the current region mid-script ? Even if AWS_DEFAULT_REGION is not defined ? I want a script to run under a number of profiles. I can scrape from aws configure list, but is there something neater ?

like image 659
mckenzm Avatar asked Jul 10 '15 03:07

mckenzm


People also ask

Is AWS CLI region specific?

For most commands, the AWS CLI automatically determines the URL based on the selected service and the specified AWS Region. However, some commands require that you specify an account-specific URL.

How do I decide which AWS Region to store my data in?

Sign in to the AWS Management Console . Choose a service to go to that service's console. In the navigation bar, choose the name of the currently displayed Region. Then choose the Region to which you want to switch.


1 Answers

aws configure get region will get you the current region at that point in your script.

If you are using a profile, then type aws configure get region --profile $PROFILE_NAME.

like image 178
Jeshan Avatar answered Oct 02 '22 09:10

Jeshan