为什么EC2对S3的基于角色的访问被拒绝?

0

【以下的问题经过翻译处理】 我有一个EC2服务器“deploy”,其中包含一个“deploy-server-profile”,其中包含一个“deploy-server-role”。我的“deploy-server-role”有一个附加的管理策略“all-servers”,其中包含2个规则:

          - Effect: "Allow"
            Action:
              - "s3:GetObject"
            Resource:
              - "arn:aws:s3:::my-app-builds/infrastructure/master/cloud-init"
          - Effect: "Allow"
            Action:
              - "s3:ListBucket"
            Resource:
              - "arn:aws:s3:::my-app-builds"

在服务器上,我确保AWS CLI使用该角色运行:

ubuntu@ip-10-63-1-114:~$ aws sts get-caller-identity | jq .Arn
"arn:aws:sts::<my_aws_account>:assumed-role/deploy-server-role/<instance_id>"

并且我验证了我可以列出存储桶:

ubuntu@ip-10-63-1-114:~$ aws s3 ls s3://my-app-builds
                           PRE infrastructure/

但我无法下载“cloud-init”文件:

ubuntu@ip-10-63-1-114:~$ aws s3api get-object --bucket my-app-builds --key infrastructure/master/cloud-init /tmp/cloud-init.sh
An error occurred (AccessDenied) when calling the GetObject operation: Access Denied
1개 답변
0

【以下的回答经过翻译处理】 我发现是因为这个对象是没有使用--acl bucket-owner-full-control的原因,因此我的帐户一开始就没有委派权限。

profile picture
전문가
답변함 5달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠