我遵循这个指示http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_GetStarted.html 以下是我得到的结果:
$ aws ecs list-clusters
{
"clusterArns": [
"arn:aws:ecs:us-east-1:xxx:cluster/MyCluster",
"arn:aws:ecs:us-east-1:xxx:cluster/default"
]
}
在 EC2 实例上:
$ cat /var/log/ecs/ecs-agent.log
t=2015-02-02T18:31:45+0000 lvl=info msg="Starting Agent" module=main stack= [agent/agent.go:32]
t=2015-02-02T18:31:45+0000 lvl=info msg="Loading configuration" module=main stack=[agent/agent.go:34]
t=2015-02-02T18:31:45+0000 lvl=info msg="Connecting to docker daemon" module=main stack=[agent/agent.go:41]
t=2015-02-02T18:31:45+0000 lvl=info msg="Connected to docker daemon" module=main stack=[agent/agent.go:43]
t=2015-02-02T18:31:45+0000 lvl=info msg="Registering Instance with ECS" module=main stack=[agent/agent.go:50]
t=2015-02-02T18:31:45+0000 lvl=crit msg="Could not register" module="api client" err="{\"__type\":\"MissingAuthenticationTokenException\",\"message\":\"Missing Authentication Token\"}" stack="[github.com/aws/amazon-ecs-agent/agent/api/api_client.go:175 agent/agent.go:51]"
t=2015-02-02T18:31:45+0000 lvl=eror msg="Error registering" module=main err="{\"__type\":\"MissingAuthenticationTokenException\",\"message\":\"Missing Authentication Token\"}" stack=[agent/agent.go:53]
cat /var/log/ecs/ecs-init.log
ecs-init [Mon Feb 2 18:31:43 UTC 2015]: pre-start
ecs-init [Mon Feb 2 18:31:43 UTC 2015]: Loading Amazon EC2 Container Service Agent from file /var/cache/ecs/ecs-agent.tar
ecs-init [Mon Feb 2 18:31:44 UTC 2015]: start
ecs-init [Mon Feb 2 18:31:44 UTC 2015]: Starting Amazon EC2 Container Service Agent
ecs-init [Mon Feb 2 18:31:45 UTC 2015]: Exited 1
那么应该在哪里设置身份验证令牌?
答案1
身份验证令牌应由您用于启动容器实例的 IAM 角色设置。
您是否按照以下步骤为 Amazon ECS 设置了 IAM 角色:http://docs.aws.amazon.com/AmazonECS/latest/developerguide/get-set-up-for-amazon-ecs.html#create-an-iam-role
此外,您需要使用该 IAM 角色启动您的容器实例。
希望这可以帮助。