Search code examples
amazon-web-servicesamazon-s3policybucket

Bad policy on my bucket in S3 and now I don't have any access


I have applied a bad policy in my bucket and now I can't access to any configuration.

This is the policy:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Deny",
            "Principal": "*",
            "Action": "s3:*",
            "Resource": [
                "arn:aws:s3:::my-bucket",
                "arn:aws:s3:::my-bucket/*"
            ],
            "Condition": {
                "NotIpAddress": {
                    "aws:SourceIp": "instance-ip"
                }
            }
        }
    ]
}

And this is the result:

enter image description here

Any solution? Please :(


Solution

  • You need to login as root account and then delete the policy.

    https://repost.aws/knowledge-center/s3-accidentally-denied-access