amazon-web-services - 使用 ecs-cli 时出现 IAM 错误

标签 amazon-web-services docker-compose amazon-ecs

我正在尝试使用撰写文件为 ECS 创建一个新任务,但即使我的用户具有所需的权限,我也会收到 AccessDeniedException。

$ ecs-cli compose --project-name test create
WARN[0000] Skipping unsupported YAML option for service...  option name=build service name=builder
WARN[0000] Skipping unsupported YAML option for service...  option name=restart service name=db
WARN[0000] Skipping unsupported YAML option for service...  option name=restart service name=dbadmin
WARN[0000] Skipping unsupported YAML option for service...  option name=restart service name=app
ERRO[0001] Error registering task definition             error=AccessDeniedException: User: arn:aws:iam::XXXXXXX:user/foo is not authorized to perform: ecs:RegisterTaskDefinition on resource: *
    status code: 400, request id: 41e6b69a-a839-11e6-84b0-e9bc2ec3f81b family=ecscompose-test
ERRO[0001] Create task definition failed                 error=AccessDeniedException: User: arn:aws:iam::XXXXXXX:user/foo is not authorized to perform: ecs:RegisterTaskDefinition on resource: *
    status code: 400, request id: 41e6b69a-a839-11e6-84b0-e9bc2ec3f81b
FATA[0001] AccessDeniedException: User: arn:aws:iam::XXXXXXX:user/foo is not authorized to perform: ecs:RegisterTaskDefinition on resource: *
    status code: 400, request id: 41e6b69a-a839-11e6-84b0-e9bc2ec3f81b 

用户附加了此策略:
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "ecs:RegisterTaskDefinition",
                "ecs:ListTaskDefinitions",
                "ecs:DescribeTaskDefinition"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}

我也尝试附加 AmazonEC2ContainerServiceFullAccess (有 ecs:*),但没有用。

最佳答案

发现问题,我使用的用户有使用 MFA(多因素身份验证)的策略,但 ecs-cli 不支持该策略。

关于amazon-web-services - 使用 ecs-cli 时出现 IAM 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40553907/

相关文章:

amazon-web-services - 上传到 S3 存储桶,导致 ECS 实例拒绝访问

amazon-web-services - 如何在jmespath查询中的数组中获取唯一值?

spring - 我应该如何部署我的所有 API?

docker - 从docker compose中的网络别名中删除服务名称

node.js - 使用docker连接nodejs和mongo

aws-cloudformation - Cloudformation ECS/fargate - 在一项任务中运行两个容器

amazon-ec2 - 所有区域的单个 key 对

amazon-web-services - 获取 https 的 “took too long to respond” 错误,但 http 工作正常

docker-compose 如何在 ip 别名接口(interface)上运行具有绑定(bind) 1 对 1 端口的容器

docker - 我如何使用 docker ecs 容器设置 aws cloudwatch 日志