Skip to main content
Five Steps for Cloud Compliance Readiness·A practical playbook for security teamsDownload
Guide · AWS

How to turn on S3 Block Public Access for an AWS account

  • Updated 25 Nov 2026

This guide shows how to find S3 buckets that could be public, switch on all four Block Public Access settings for the whole account and confirm they are in force. It is written for AWS administrators who own S3 in a single account or in an AWS Organization.

Before you start

S3 Block Public Access overrides bucket policies and ACLs that would otherwise let anyone on the internet read your data. It has four settings: BlockPublicAcls, IgnorePublicAcls, BlockPublicPolicy and RestrictPublicBuckets. AWS recommends turning on all four for the account, and they apply to every Region.

  • Permissions to look: s3:ListAllMyBuckets, s3:GetAccountPublicAccessBlock, s3:GetBucketPublicAccessBlock, s3:GetBucketPolicyStatus and s3:GetBucketWebsite.
  • Permission to change: s3:PutAccountPublicAccessBlock. Your organisation may restrict it with a service control policy.
  • Tools: the AWS CLI configured for the account, and the Amazon S3 console.
  • Organization policy: if your account is managed by an organization-level Block Public Access policy, you cannot change the account settings. Organization policies apply all four settings together and override the account. In that case ask the organization administrator.
  • Know the risk: AWS says to verify that your applications work without public access first. A static website hosted directly from S3 is the classic example that needs public access.

Step by step

Steps 1 to 3 only read information. Steps 4 and 5 change your account and are marked CHANGE.

  1. Read the current account setting (read-only).
    ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
    aws s3control get-public-access-block --account-id "$ACCOUNT_ID"
    If the account has no configuration yet, the call returns a NoSuchPublicAccessBlockConfiguration error. Otherwise it lists the four settings. If the account is under an organization policy, it returns the enforced policy.
  2. List buckets that are public today (read-only). Run this per bucket; the policy status call answers whether the bucket policy makes it public:
    for b in $(aws s3api list-buckets --query "Buckets[].Name" --output text); do
      echo "== $b"
      aws s3api get-bucket-policy-status --bucket "$b" --query "PolicyStatus.IsPublic" --output text 2>&1
      aws s3api get-public-access-block --bucket "$b" 2>&1
    done
    A bucket without a bucket policy returns a NoSuchBucketPolicy error, which is expected. This only covers bucket policies. To also catch public ACLs, use IAM Access Analyzer for S3, which lists buckets whose ACLs, bucket policies or access point policies grant public or cross-account access.
  3. Find buckets that need public access on purpose (read-only). For every bucket flagged above, ask its owner why. To spot buckets that host a website:
    aws s3api get-bucket-website --bucket example-bucket-name
    A NoSuchWebsiteConfiguration error means the bucket is not hosting a website. Decide for each legitimate public bucket whether it can move behind another delivery method, or whether it will keep its own bucket-level settings.
  4. CHANGE: turn on all four settings for the account.
    aws s3control put-public-access-block --account-id "$ACCOUNT_ID" \
      --public-access-block-configuration BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true
    Console: Amazon S3 > Account and organization settings > Block Public Access settings for this account > Edit, select all four, choose Save changes and type confirm. The setting reaches all Regions, but AWS says it may not take effect everywhere at the same moment. It does not edit existing policies or ACLs. It only overrides them while the setting stays on. To undo, run aws s3control delete-public-access-block --account-id "$ACCOUNT_ID", but remember that existing public policies and ACLs then become effective again.
  5. CHANGE (optional): also turn them on per bucket. AWS recommends all four settings on each bucket too, so a bucket stays protected if the account setting is ever removed:
    aws s3api put-public-access-block --bucket example-bucket-name \
      --public-access-block-configuration BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true
    For many accounts, AWS Organizations offers an S3 policy that applies the setting centrally. Remember it is all four settings or none, and it overrides account-level changes.

Check it worked

These commands only read.

ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
aws s3control get-public-access-block --account-id "$ACCOUNT_ID"
aws s3api get-public-access-block --bucket example-bucket-name

The first command should show BlockPublicAcls, IgnorePublicAcls, BlockPublicPolicy and RestrictPublicBuckets all as true. In the console, the account page should show all four as On. Remember that the bucket policy status keeps describing the policy itself, so a bucket can still report a public policy while the account setting blocks it. Test the applications that use your buckets too, because a rejected request is the sign that something relied on public access.

Common mistakes

  • Turning on RestrictPublicBuckets without checking cross-account access. If one statement in a bucket policy is public, the whole policy counts as public and access from other accounts stops, even for statements that name a specific account.
  • Assuming Block Public Access cleans up. It does not edit existing policies or ACLs, so removing the setting later makes them effective again.
  • Breaking a static website hosted directly from a bucket.
  • Overlooking policies that look narrow but count as public. AWS treats a condition on a very broad IP range as public, and a wildcard in a condition value does not make a policy non-public.
  • Forgetting that the account setting is silently locked when an organization policy applies, and that the put and delete calls return Access Denied.
  • Treating Block Public Access as the only control. AWS says to also review identity-based policies and resource policies such as KMS key policies for public grants.
  • Configuring only buckets you know about and never the account, so new buckets are unprotected.

How ConfigCobra helps

ConfigCobra is read-only: it never changes your AWS. It reads your accounts through an assume-role connection, and its AWS coverage includes CIS Amazon Web Services Foundations v7.0.0 (70 controls), 306 controls across the four AWS benchmarks. The related checks below cover the S3 Block Public Access setting and neighbouring S3 and access settings.

The AWS inventory lists resources across the accounts in scope with their security properties. For a failing control, remediation impact analysis shows the affected resources and identities before you apply a fix, and each finding can come with copy-paste remediation steps. Scheduled scans with drift detection send an email when a control regresses.

See where your AWS stands

A read-only assessment against the CIS benchmarks, prioritised so you know what to fix first.

Get in touch

Let's talk.

Whether you're evaluating ConfigCobra, running an audit, or managing a client fleet — we respond within one business day.

Free trial