Tools
Bucket policy generator
Choose what you want to allow or block and copy the policy in JSON with the steps to apply it. Free, no sign-up.
What a bucket policy is
It is a JSON document stored on the bucket that says who can do what with it and under which conditions. It applies to every request, whichever key it comes from.
A Deny rule always wins over an Allow. So before you save a policy that blocks, check that it does not lock you out or lock out the tools that use the bucket.
Frequently asked questions
Can I use a bucket policy on Cloudflare R2?
No. R2 does not implement PutBucketPolicy. Buckets are private by default and you make them public in the bucket settings, with an r2.dev subdomain for testing or with a custom domain. To limit what a key can do, use R2 API tokens.
What do I do if I lock myself out?
On AWS, sign in with the account root user and delete the policy: AWS says that is how you get access back. With an IP limit, you can also edit it from an allowed address. On Wasabi and Spaces, delete it with a key and an address the policy does not block.
How is it different from an IAM policy?
An IAM policy is attached to a user or role and says what that identity can do on any bucket. A bucket policy is attached to the bucket and applies to whoever accesses it, even from other accounts or anonymously. When both apply, an explicit Deny in either one wins.
Does Nubbo need a bucket policy?
No. Nubbo connects with an access key and shares files with links signed for a short time, so the bucket can stay private. Just make sure a policy you add does not block Nubbo, such as an IP limit.
Sources
Policies and support checked against these pages.
- Bucket policy examples in Amazon S3
- Condition keys in Amazon S3
- Block Public Access in Amazon S3
- Server-side encryption in Amazon S3
- Regain access to an Amazon S3 bucket
- Bucket policies in Wasabi
- Restrict a Wasabi bucket by IP
- Restrict a Wasabi bucket to users
- Public access in Wasabi
- Bucket policies in Spaces
- Spaces bucket policy with Terraform
- Access keys in Spaces
- Spaces S3 compatibility
- Backblaze B2 S3-compatible API
- Backblaze B2 S3 API: private and public buckets
- Cloudflare R2 S3 API