An error occurred (AccessDenied) when calling the PutBucketPolicy operation: Access Denied

0

Hello,

aws CLI : aws s3api put-bucket-policy --bucket compty08052023 --policy file://public-access-policy.json

An error occurred (AccessDenied) when calling the PutBucketPolicy operation: Access Denied

AmazonS3FullAccess AWS managed Directly i also tried AdministratorAccess and even to create policy like : { "Version": "2012-10-17", "Statement": [ { "Sid": "S3BucketManagement", "Effect": "Allow", "Action": [ "s3:CreateBucket", "s3:DeleteBucket", "s3:ListAllMyBuckets" ], "Resource": "" }, { "Sid": "S3BucketPolicyManagement", "Effect": "Allow", "Action": [ "s3:PutBucketPolicy", "s3:GetBucketPolicy", "s3:DeleteBucketPolicy" ], "Resource": "arn:aws:s3:::" } ] } but nothing worked. Don t know what to do.

1개 답변
0

Hello,

When I have seen Access Denied like this, it's the credentials that you are using to perform the operation and not what the policy looks like. Based on the example above you are using the default user credentials for your CLI on the host that you are using. I say that because there is no --profile option to the CLI statement above. So what access does the account that you are using have? In the documentation https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketPolicy.html. it states.

If you don't have PutBucketPolicy permissions, Amazon S3 returns a 403 Access Denied error.

Which is what you are receiving when making the call. If that's the issue, you only need to grant the account that you are using PutBucketPolicy right, or something more general like PowerUser

profile pictureAWS
답변함 일 년 전
profile picture
전문가
검토됨 4달 전

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

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

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

관련 콘텐츠