use*_*375 61 amazon-ec2 amazon-web-services aws-cli
我正在尝试使用aws容器服务,根据http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_GetStarted.html中的文档
运行命令时抛出以下错误:
aws ecs list-container-instances --cluster default
You must specify a region. You can also configure your region by running "aws configure".
Run Code Online (Sandbox Code Playgroud)
该文档未提及有关指定默认区域的任何信息.我们如何在控制台中执行此操作?
Pey*_*rov 59
我想你需要使用例如:
aws ecs list-container-instances --cluster default --region us-east-1
Run Code Online (Sandbox Code Playgroud)
这当然取决于您所在的地区.
Jas*_*son 36
"您必须指定区域"不是ECS特定错误,任何AWS API/CLI/SDK命令都可能发生这种错误.
对于CLI,请设置AWS_DEFAULT_REGION环境变量.例如
export AWS_DEFAULT_REGION=us-east-1
或者在CLI配置文件中设置它:〜/ .aws/config
[default]
region=us-east-1
Run Code Online (Sandbox Code Playgroud)
或使用CLI调用传递/覆盖它:
aws ecs list-container-instances --cluster default --region us-east-1
Ina*_*mus 15
#1-运行此命令以一劳永逸地配置区域:
aws configure set region us-east-1 --profile admin
Run Code Online (Sandbox Code Playgroud)
admin如果配置文件不同,请在配置文件旁边进行更改
us-east-1如果您的地区不同,请更改.
#2-再次运行命令:
aws ecs list-container-instances --cluster default
Run Code Online (Sandbox Code Playgroud)
Put*_*nik 13
如果您已配置了所需的所有内容.aws/config,但.aws/credentials仍然出现此错误 - 请仔细检查方括号中的名称。
它应该[profile myLovelyAccName]在config和[myLovelyAccName]中credentials。
需要注意的两点:
config仅在文件中只是为了添加 Dimitrov 先生和 Jason 的回答,如果您使用的是特定配置文件并且您已经将您的区域设置放在那里,那么对于您需要添加的所有请求
“--profile”选项。
例如:
假设您有 AWS Playground 配置文件,并且 ~/.aws/config 有 [profile playground] 进一步具有类似的内容,
[profile playground]
region=us-east-1
然后,使用类似下面的东西
aws ecs list-container-instances --cluster default --profile playground
我发布得太早了,但是下面的链接给出了配置方法
http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
下面的链接给出了获取访问密钥的方法
http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-set-up.html#cli-signup
| 归档时间: |
|
| 查看次数: |
65540 次 |
| 最近记录: |