skip to Main Content

What is the command to switch the region on aws cli. I want to switch to another region where my lambdas are present
I have tried these commands but they doesn’t work

aws --region <region_name>
aws set region <region_name>
aws configure region <region_name>
aws lambda .... --region <region_name>

2

Answers


  1. As far as I can tell --region <region> should do the job. In most of the cases I use the region parameter as a part of my profile. If it doesn’t work in your case, check the environment variable.

    Reference: Command line options – AWS Command Line Interface

    Login or Signup to reply.
  2. You can set the AWS_REGION environment variable so that the AWS CLI would use it in the subsequent calls:

    export AWS_REGION=us-east-1
    

    Then if you use

    aws lambda ...
    

    command it would be executed in that region.

    Alternatively, if you want this change to be persisted, you can change you ~/.aws/credentials file and set the region there.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search