AWS CLI在错误的区域执行 [英] AWS CLI executing in wrong regions

查看:112
本文介绍了AWS CLI在错误的区域执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的AWS配置文件默认配置为eu-west-1,但是当我运行AWS CLI命令时,它在us-east-1中执行:

My AWS profile is configured to default to eu-west-1, however when I run an AWS CLI command, it is executing in us-east-1:

>aws configure get region
eu-west-1

>aws events put-rule --name hourly_trigger --schedule-expression "rate(60 minutes)"
{ 
  "RuleArn": "arn:aws:events:us-east-1:588237033746:rule/hourly_trigger"
}

我调查了配置文件和配置选项,但无法确定原因.我的个人资料设置如下:

I've looked into profiles and config options and can't determine why this is. My profile is set as follows:

[default]
region = eu-west-1

如果我添加--region,此命令将在预期的区域中工作

And this command works in the intended region if I add --region

>aws events put-rule --name hourly_trigger --schedule-expression "rate(60 mi
nutes)" --region eu-west-1
{
    "RuleArn": "arn:aws:events:eu-west-1:588237033746:rule/hourly_trigger"
}

推荐答案

AWS区域通过以下三种方式获得:

AWS Region is obtained through three ways:

  1. 检查您的命令是否包含--region
  2. 如果未指定,则检查环境变量AWS_DEFAULT_REGION
  3. 如果未设置,它将检查〜/.aws/config文件中定义的区域

确保未设置AWS_DEFAULT_REGION.然后它将自动使用配置文件中定义的区域.

Make sure AWS_DEFAULT_REGION is not set. Then it should automatically use the region defined in the config file.

这篇关于AWS CLI在错误的区域执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆