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
回答済み 1年前
profile picture
エキスパート
レビュー済み 4ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ