英文:
Command to switch the region on aws cli
问题
以下是要翻译的内容:
"切换 AWS CLI 区域的命令是什么?我想切换到另一个区域,我的 Lambda 函数在那里。我尝试了以下命令,但它们不起作用:
aws --region <region_name>
aws set region <region_name>
aws configure region <region_name>
aws lambda .... --region <region_name>
```"
<details>
<summary>英文:</summary>
<br/>
What is the command to switch the region on aws cli. I want to switch to another region where my lambdas are present<br/>
I have tried these commands but they doesn't work<br/>
aws --region <region_name>
aws set region <region_name>
aws configure region <region_name>
aws lambda .... --region <region_name>
</details>
# 答案1
**得分**: 3
你可以设置`AWS_REGION`环境变量,这样AWS CLI将在后续的调用中使用它:
```bash
export AWS_REGION=us-east-1
然后,如果你使用
aws lambda ...
命令,它将在该区域执行。
另外,如果你希望将此更改持久化,你可以修改你的~/.aws/credentials
文件并在那里设置区域。
英文:
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 your ~/.aws/credentials
file and set the region there.
答案2
得分: 2
--region <region>
应该可以胜任工作。在大多数情况下,我使用region
参数作为我的配置文件的一部分。如果在您的情况下不起作用,请检查环境变量。
参考链接:命令行选项 - AWS命令行界面
英文:
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
答案3
得分: 0
AWS CLI提供了在任何时候设置区域的方法。您可以使用以下命令来设置区域:
aws configure --region <region>
例如:
aws configure --region us-east-2
之后,CLI将要求您输入ID和密钥。您可以看到它将使用现有凭据,只需按回车键继续。如果它要求输入区域,请提供新的区域然后按回车,就这样!您已经可以继续前进了。
英文:
AWS cli provides the way to set region at anytime you wish. You can use following command to set the region
aws configure --region <region>
For example:
aws configure --region us-east-2
After this cli will ask you ID and Secret, You can see it will come with existing creds just hit enter and move ahead. If it ask for region give the new region and hit enter, That's it! You are good to go ahead.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论