Skip to content

How to solve "explicit deny" in s3.

0

While testing adding permissions to S3, we encountered a situation where access was lost for all accounts. Even with the root account, we are no longer able to perform any actions on the s3. (I added all permissions to s3, but "no permission" alarm is generated for all functions (objects, properties, permissions, ...) of s3.) In this case, is there a way to reset the permissions applied to s3?

asked a year ago382 views

2 Answers
0

Hello.

You can reset the bucket policy for an S3 bucket if you are signed in as the root user of your AWS account.
Try resetting your bucket policy using the steps in the following document:
https://repost.aws/knowledge-center/s3-accidentally-denied-access

EXPERT

answered a year ago

AWS
EXPERT

reviewed a year ago

0

To regain access and solve the "explicit deny" issue, you need to use the AWS Command Line Interface (CLI) or an AWS SDK to modify the bucket policy directly. The AWS Management Console may not work if the root account has been denied access to the S3 bucket's properties.

Use the AWS CLI: You can use the aws s3api put-bucket-policy command to update the bucket policy. First, you'll need a JSON file containing the new, corrected policy that removes the problematic deny statement.

aws s3api put-bucket-policy --bucket YOUR_BUCKET_NAME --policy file://policy.json

Replace YOUR_BUCKET_NAME with your bucket's name and policy.json with the name of your file.

Use an AWS SDK: If you're more comfortable with a programming language, you can use an AWS SDK (like Boto3 for Python) to programmatically update the bucket policy.

Once the bucket policy is updated and the explicit deny statement is removed, all previously granted permissions should be restored.

References

Boto3 Documentation for put_bucket_policy:

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.