【发布时间】:2020-10-06 22:54:15
【问题描述】:
我一直在使用 AWS 的 ECS CLI 来启动和关闭 EC2 实例集群以执行各种任务。我遇到的问题是它似乎指的是我不知道如何更改的旧信息。
例如,我刚刚创建了一个集群,my-second-cluster 成功,并且可以在 AWS 控制台中看到:
$ ecs-cli up --keypair "my-keypair" --capability-iam --size 4 --instance-type t2.micro --port 22 --cluster-config my-second-cluster --ecs-profile a-second-profile
INFO[0001] Using recommended Amazon Linux 2 AMI with ECS Agent 1.45.0 and Docker version 19.03.6-ce
INFO[0001] Created cluster cluster=my-second-cluster region=us-east-1
INFO[0002] Waiting for your cluster resources to be created...
INFO[0002] Cloudformation stack status stackStatus=CREATE_IN_PROGRESS
INFO[0063] Cloudformation stack status stackStatus=CREATE_IN_PROGRESS
INFO[0124] Cloudformation stack status stackStatus=CREATE_IN_PROGRESS
VPC created: vpc-123abc
Security Group created: sg-123abc
Subnet created: subnet-123abc
Subnet created: subnet-123def
Cluster creation succeeded.
...但是eci-cli ps 返回一个引用旧集群的错误:
$ ecs-cli ps
FATA[0000] Error executing 'ps': Cluster 'my-first-cluster' is not active. Ensure that it exists
明确指定集群 (ecs-cli ps --cluster my-second-cluster --region us-east-1) 不会返回任何内容,即使我在登录 AWS 控制台时看到了 4 个 EC2 实例。
支持细节:
在创建第二个集群之前,我创建了第二个配置文件并将其设置为默认值。我还将新集群设置为默认值。
$ ecs-cli configure profile --access-key <MY_ACCESS_KEY> --secret-key <MY_SECRET_KEY> --profile-name a-second-profile
$ ecs-cli configure profile default --profile-name a-second-profile
$ ecs-cli configure --cluster my-second-cluster --region us-east-1
INFO[0000] Saved ECS CLI cluster configuration default.
我不清楚这些 ECS 配置文件和集群配置存储在哪里(我希望将它们视为 ~/.aws 中的文件,但没有),或者如何在 cli 命令之外进行操作反馈。关于我缺少什么的任何想法?
【问题讨论】:
标签: amazon-web-services amazon-ec2 aws-cli amazon-ecs