I was recently playing with the S3 service and I noticed that I had a bucket that I no longer needed. It was created by Elastic Beanstalk when I was playing with the service earlier.
The error is actually quite simple to understand, it's clear that based on what we see below, the issue is with permissions.
What surprised me was the fact that I was using an AWS root account to try and delete this bucket, yet it would not work. I mean an AWS root account has access to everything right? Well, yes, but you have some exceptions, such as when there’s an explicit deny.
In the case of the S3 bucket mentioned above, if we go back to look at the policy, we see that it has indeed been set to explicitly deny deletes:
We can just delete the Policy in question and then go back and delete the bucket