EC2 role-based access to S3 denied

0

I have an EC2 server deploy that has a deploy-server-profile that contains a deploy-server-role. My deploy-server-role has an attached managed policy all-servers that contains 2 rules:

          - 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"

On the server, I made sure AWS CLI is running with the role

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>"

And I verified that I could list the bucket

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

But I could not download the cloud-init file

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개 답변
2
수락된 답변

Never mind, I found out that the object was put there without --acl bucket-owner-full-control, so my account never had the permission to delegate in the first place.

답변함 2년 전

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

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

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

관련 콘텐츠