Cybermatic.aiAll guides →

The Cybermatic Signal · Fix-it Guides · Cloud · AWS

How to block public access to AWS S3 buckets

← All guides · Time to fix: 5 minutes per bucket, plus 2 minutes once for the account-wi · AWS

Block Public Access is an AWS setting that overrides any bucket policy or ACL that would otherwise let anonymous internet users read or list your bucket contents. Any AWS account that has ever created a bucket — especially for backups, exports, or file uploads — should verify this is on. The fix takes about five minutes per bucket and another two minutes to lock it down account-wide.

The fix, verified

Public S3 bucket

Severitycritical · AWS
Where to clickS3 console → the bucket → Permissions → Block public access → Edit → tick all four → Save. Then S3 → Block Public Access settings for this account → turn all four on account-wide.
Or run
aws s3api put-public-access-block --bucket BUCKET-NAME --public-access-block-configuration BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true
Before you doA bucket that hosts a public website needs CloudFront with an origin access control instead of public objects.
Maps toCIS AWS 2.1.4SOC2 CC6.1HIPAA 164.312(a)

What this setting does and what goes wrong without it

S3 buckets have two layers of access control: bucket policies and access control lists (ACLs). Either one can accidentally grant public read access — a single misconfigured policy statement with "Principal": "*" is enough. Block Public Access is a separate override that ignores or rejects those grants entirely. When it is off, automated scanners on the internet find open buckets within hours of creation. A realistic scenario: a developer exports a database to S3 for a one-time migration, forgets to restrict the bucket, and weeks later a routine scan turns up customer records sitting in plain view. The developer never knew the bucket was public.

Check whether you are affected

In the S3 console, open any bucket, go to Permissions, and look at the Block Public Access section. If any of the four toggles is off, the bucket is potentially exposed. To check every bucket at once, go to S3 → Block Public Access settings for this account — if that page shows anything other than all four settings enabled, at least one bucket in the account could be public. You can also run a quick CLI check:

A fully protected bucket returns all four values as true. A missing key or a false value means that protection is not in place.

How to fix it

Fix each bucket individually first, then lock the whole account. In the console: S3 → the bucket → Permissions → Block public access → Edit → tick all four checkboxes → Save. Repeat for every bucket. Then go to S3 → Block Public Access settings for this account and turn all four on there as well — this prevents any future bucket from being made public, even by mistake. If you prefer the CLI, run this command for each bucket, replacing BUCKET-NAME with the actual name:

aws s3api put-public-access-block --bucket BUCKET-NAME --public-access-block-configuration BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true

To apply the account-level setting via CLI, run the same command without the --bucket flag and target the account endpoint, or use the console — the account-level control is straightforward in the UI and is the more reliable place to set it once.

What might break and how to avoid it

The one legitimate use case that breaks is a bucket serving a public static website directly over S3's website endpoint. If you block public access on that bucket, the site goes down. The right fix is not to leave the bucket public — it is to put CloudFront in front of the bucket and use an origin access control (OAC) to let CloudFront fetch objects privately. Your visitors still get the content; the bucket itself is never exposed to the open internet. Before you enable Block Public Access on any bucket, check whether it has a static website hosting configuration enabled under Properties. If it does, set up CloudFront with OAC first, update your DNS, confirm the site loads, and then enable the block.

Keeping it fixed going forward

The account-level Block Public Access setting is your main long-term control — once it is on, no new bucket can be made public without explicitly removing it. To enforce this across an AWS Organization, apply a Service Control Policy (SCP) that denies the s3:PutBucketPublicAccessBlock action with a condition that sets any value to false. In AWS Config, enable the managed rule s3-bucket-public-read-prohibited and s3-bucket-public-write-prohibited to get continuous compliance reporting. Review the Config findings monthly or pipe them into your ticketing system so nothing drifts quietly.

Questions people ask

Will turning on Block Public Access break my application that reads from S3?

Only if your application was relying on anonymous public access rather than IAM credentials or presigned URLs. Applications that authenticate with an IAM role or access key are not affected. Check your bucket policy for any statement with "Principal": "*" — if your app depends on one of those, you need to switch it to authenticated access before enabling the block.

I have dozens of buckets. Is there a way to check them all at once?

Yes. Run aws s3api list-buckets to get every bucket name, then loop through the list calling aws s3api get-public-access-block on each one. Any bucket that returns a false value or throws a NoSuchPublicAccessBlockConfiguration error needs to be fixed. AWS Config with the s3-bucket-public-read-prohibited rule will also flag non-compliant buckets across the account in one view.

Does the account-level setting automatically fix existing buckets?

It prevents new public access from being granted, and the RestrictPublicBuckets flag blocks public access even on buckets that already have a public policy. However, it is still good practice to set the block on each bucket individually so the configuration is explicit and visible at the bucket level rather than only inherited from the account.

Is this open in your environment?

Cybermatic checks for "Public S3 bucket" automatically — on every connected account, every day — and shows you the exact fix above next to each one it finds. The free scan takes about ten minutes and needs no credit card.

Run the free scan All guides →

Part of The Cybermatic Signal. Written by the Cybermatic editorial agent from the configuration check Cybermatic runs for this setting (ID aws-public-s3) and reviewed before publication. The click path, command and caution in the fix card are the vendor's documented procedure as of 2026-11-10. Found an error? Write to info@cybermatic.ai.

BriefingIssuesFlashGuidesInsurance checkDomain checkSubscribe

Cybermatic.ai by Ironhawk Group · 9330 Lyndon B Johnson Fwy, Suite 900 · Dallas, TX 75243 · Privacy · cybermatic.ai