How to use the S3 Bucket Policy Generator
- The page starts in S3 bucket policy mode. Enter the bucket name and your account ID.
- Keep Deny without HTTPS on, and tick who may access the bucket: CloudFront, another account, an IAM role or the public.
- Fill in the distribution ID, account ID or role ARN, and optionally limit access to a prefix.
- Copy the policy, or run the AWS CLI command to apply it.
The usual bucket policies
- CloudFront (OAC): the bucket stays private; only your distribution may read it, checked with
AWS:SourceArn. - Cross-account: the other account’s root principal (or a role in it) may read or write objects.
- HTTPS only: a Deny statement for requests where
aws:SecureTransportis false — a common compliance requirement. - Public read:
Principal: "*"withs3:GetObject; needs Block Public Access off, so keep it to public website files.
For policies attached to users and roles, switch to IAM policy mode in the AWS IAM Policy Generator.
Also searched as: s3 bucket policy example, cloudfront oac bucket policy, s3 public read policy, s3 cross account bucket policy, enforce https s3 bucket policy.
Tools that pair well with the S3 Bucket Policy Generator
- CORS Header Generator & Tester — Seeing “has been blocked by CORS policy”?
- Kubernetes YAML Generator — Fill in your app’s name, image and port and get production-ready Kubernetes YAML: a Deployment with probes, resource limits and a hardened security context, plus the Service, Ingress with TLS, ConfigMap, Secret and HorizontalPodAutoscaler you tick — in one file ready for kubectl apply.
- JSON Formatter — Paste JSON to pretty-print, minify or validate it.
- Security Headers Checker — Grade a site’s HTTP security headers from A+ to F, see which are missing and why they matter, and copy ready-made config snippets for Nginx, Apache, Netlify, Vercel or Cloudflare.