Four switches, two levels
Block Public Access has four settings — BlockPublicAcls, IgnorePublicAcls, BlockPublicPolicy and RestrictPublicBuckets. Each can be set per bucket and per account. A bucket policy cannot loosen the account-level setting.
A bucket rarely starts public. It starts with a policy added for a launch page, an ACL written by old tooling, or an account-level guardrail turned off so one bucket could serve a website. The useful question is not "is there a policy" but "can an anonymous request read this object right now, from outside our network".
This page is free and defensive only. It covers how to inventory your own buckets, how to prove reachability instead of inferring it, and the order in which to close the gap without breaking a distribution or a static site.
Block Public Access has four settings — BlockPublicAcls, IgnorePublicAcls, BlockPublicPolicy and RestrictPublicBuckets. Each can be set per bucket and per account. A bucket policy cannot loosen the account-level setting.
GetBucketPolicyStatus reports whether the bucket policy is public. A block setting can still override it, so read the policy, the blocks and an anonymous request together before you conclude anything.
Buckets created before Object Ownership moved to BucketOwnerEnforced may still carry grants to the AllUsers group. A clean bucket policy does not clear an ACL.
Server access logs and CloudTrail data events record the request, but an anonymous read has no meaningful identity. Filter on an empty requester rather than on a user name.
| Command or view | What it tells you |
|---|---|
| aws s3api list-buckets --query 'Buckets[].Name' --output text | The inventory. The bucket you forgot is usually in a second account, so repeat with every profile you operate. |
| aws s3api get-public-access-block --bucket "$B" | The bucket-level blocks. NoSuchPublicAccessBlockConfiguration means none are set here; the account level may still protect the bucket. |
| aws s3api get-bucket-policy-status --bucket "$B" | PolicyStatus.IsPublic. True means the policy grants public access; it does not by itself prove an anonymous request succeeds. |
| aws s3api get-bucket-acl --bucket "$B" | Grants to AllUsers or AuthenticatedUsers. Any such grant is a public path that a policy review misses. |
| aws s3api get-bucket-ownership-controls --bucket "$B" | The object ownership setting. BucketOwnerEnforced disables ACLs; any other value means ACLs still matter. |
| aws s3api get-bucket-website --bucket "$B" | Static website hosting. It needs public read, and it is often left on long after the site moved to CloudFront. |
| curl -sI "https://$B.s3.amazonaws.com/$K" | An unauthenticated request from outside your network. A 200 or 206 is reachability; a 403 is a denial. Do this only against your own objects. |
| aws accessanalyzer list-findings --analyzer-arn "$ARN" | External-access findings for S3 buckets, including public and cross-account access. Treat it as a second opinion, not the only check. |
| aws s3api get-object-acl --bucket "$B" --key "$K" | Object-level grants on a sampled key, only where ACLs are still enabled. |
| # | Failure mode | What you see | What to do |
|---|---|---|---|
| 1 | A policy with a wildcard principal and s3:GetObject | IsPublic: true; the statement was added for one launch asset and never narrowed. | Replace the principal with the distribution or role that needs it; do not just delete the statement and break a live page. |
| 2 | A legacy ACL granting AllUsers | The policy is clean and the ACL still shows a public read grant; Access Analyzer may not flag the ACL path the same way. | Switch Object Ownership to BucketOwnerEnforced after checking which tools still call PutObjectAcl. |
| 3 | Account-level Block Public Access is off | Every new bucket starts one policy away from public, and no guardrail catches the next one. | Turn on the account-level settings after inventorying static sites and distributions, because they will break public origins. |
| 4 | Static website hosting still enabled | A second, HTTP-only endpoint answers with directory-style paths that the API endpoint does not serve. | Move the site to CloudFront with an origin access control, then disable website hosting. |
| 5 | CloudFront origin left public | The distribution still returns 200, so nobody notices that the bucket is also directly readable. | Use origin access control, then restrict the bucket policy to that distribution's service principal. |
| 6 | A "public" policy that is actually constrained | IsPublic: true, but the statement requires a VPC endpoint or a source IP range and anonymous internet requests get 403. | Prove it with an anonymous request before removing anything; a true finding and a noisy one need different fixes. |
| 7 | A long-lived presigned URL | No policy change and no public ACL, but the object is readable until the signature expires, including from a page or a log it leaked into. | Cap expiry, avoid putting signed URLs in client code, and rotate the credentials that signed them if they leaked. |
| Step | Action | Why this order |
|---|---|---|
| 1 | Snapshot the policy, ACL, blocks and website configuration | Versioning does not cover configuration. You need the exact previous state to roll back a broken page. |
| 2 | Prove reachability from outside | An alert on a public policy is not the same as an object the internet can read; do not change production on an inference. |
| 3 | Fix the distribution path first | If CloudFront still points at the bucket by origin domain name, turning on blocks breaks the site before it fixes the exposure. |
| 4 | Enable the bucket-level blocks | BlockPublicPolicy and IgnorePublicAcls stop new public grants even if a policy is added again. |
| 5 | Enable the account-level blocks | The durable guardrail. Do it after step 3, and expect any remaining public website to break loudly. |
| 6 | Rotate what the objects exposed | Public JavaScript and configuration files leak keys and tokens; closing the bucket does not un-leak them. |
From a host outside the VPC and without credentials, request a known key. Confirm 403 after the change, and confirm the same key still loads through the distribution.
Re-read GetBucketPolicyStatus and the ACL. A public policy left in place but overridden by a block is a latent finding, not a fixed one.
Create a throwaway bucket, attach a public-read policy, and confirm the account-level block rejects it. Delete the bucket afterwards.
Confirm the finding moves to resolved, and that no new finding appeared for the distribution or the logs bucket.
No. A bucket can be intentionally public, for example a static site or a public dataset. The finding is that the public path is unowned, undocumented or broader than the objects it was meant to serve. Record the intent, then narrow the scope.
Check which endpoint you requested. The static website endpoint and the REST endpoint behave differently, and a CDN in front can serve a cached copy after the bucket is closed. Test the exact URL an outsider would use.
It is the right end state, but it will break public website endpoints and any distribution that still reads the bucket as a public origin. Fix those paths first, then enable the blocks during a change window you can watch.
They prove the request happened, the time, the source address and the object. An anonymous request has no authenticated identity, so logs answer "what was taken" far better than "who took it".
The paid runbooks cover the same shape of problem on other platforms: a control that looks enabled, a path that bypasses it, and a rollback that has to be rehearsed before the change.
This page is free, no checkout. Paid runbooks are $9.99 each and covered by the 7-day refund policy at /runbooks/refund.