S3 access control and Block Public Access

Intermediate · 17 min

Who can read your bucket: IAM and bucket policies, cross-account rules, Block Public Access, disabled ACLs and safe sharing patterns.

Before thisPolicy documents and evaluation logicS3 buckets, objects and consistency

AWS Events · 22 min · from 5:06

S3 access control and Block Public Access

The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.

Taught by AWS EventsReport a problem with this video
Not started
Set this lesson's status

What you'll learn

  • New buckets start private: Block Public Access is on, ACLs are disabled and only the owning account has access until a policy says otherwise.
  • Within one account, an allow in either the identity policy or the bucket policy is enough. Across accounts you need both. An explicit deny anywhere wins.
  • Bucket actions and object actions use different ARNs. s3:ListBucket applies to the bucket, s3:GetObject applies to bucket/*.
  • Block Public Access is a set of four overrides that beat policies and ACLs. Turn all four on for the whole account and make exceptions rare and deliberate.
  • Keep Object Ownership at Bucket owner enforced, which disables ACLs, and express all access in policies.
  • To share private objects, prefer presigned URLs or CloudFront with origin access control over making anything public.

Why this deserves its own lesson

A bucket is an HTTPS endpoint with a guessable name. One wrong statement and everything in it is readable by anyone on the internet. Many of the leaks you’ve read about weren’t clever attacks. Someone opened a bucket to fix a broken download and forgot.

AWS has since changed the defaults. A new general purpose bucket blocks public access, has ACLs disabled and is reachable only by its owning account. Your job is to grant what’s needed without undoing that.

Two places a permission can live

S3 uses the same policy language and evaluation logic as the rest of IAM. A grant can sit in:

  • an identity policy, attached to a user or role: “this principal may do these things”;
  • a bucket policy, attached to the bucket: “these principals may do these things to me”.

Inside one account, either one allowing is enough. Across accounts, both must allow: think of a visitor who needs their own company’s travel approval and the host’s invitation. An explicit Deny in either place beats every allow.

Identity policies suit “what can my application do”. Bucket policies suit cross-account grants, service principals and guard rails that must hold no matter who asks.

Two kinds of ARN

The bucket and the objects inside it are different resources:

{
  "Version": "2012-10-17",
  "Statement": [
    { "Effect": "Allow",
      "Action": "s3:ListBucket",
      "Resource": "arn:aws:s3:::shop-reports",
      "Condition": { "StringLike": { "s3:prefix": "team-a/*" } } },
    { "Effect": "Allow",
      "Action": ["s3:GetObject", "s3:PutObject"],
      "Resource": "arn:aws:s3:::shop-reports/team-a/*" }
  ]
}

Listing is a bucket action, restricted here with a condition. Reading and writing are object actions, restricted by the resource ARN. Mixing these up is the most common cause of a confusing AccessDenied.

A useful guard rail denies any request that isn’t over TLS:

{ "Effect": "Deny", "Principal": "*", "Action": "s3:*",
  "Resource": ["arn:aws:s3:::shop-reports", "arn:aws:s3:::shop-reports/*"],
  "Condition": { "Bool": { "aws:SecureTransport": "false" } } }

Block Public Access

Block Public Access is an override that sits above policies and ACLs. It has four switches:

Setting What it does
BlockPublicAcls rejects requests that would set a public ACL
IgnorePublicAcls ignores public ACLs that already exist
BlockPublicPolicy rejects a new public bucket policy
RestrictPublicBuckets limits a bucket with a public policy to AWS services and the owner’s account

Two stop new mistakes and two neutralise old ones. Note the last one also cuts off any cross-account grant written into a public policy.

The settings exist per bucket, per access point, per account and across an organization, and S3 applies the most restrictive combination. Turn all four on at the account or organization level. Then a mistake in one bucket can’t expose it.

“Public” has a precise meaning. S3 assumes a policy is public until its statements are pinned to fixed values, such as a named account, an organization or a VPC endpoint. A wildcard principal with no such condition counts.

ACLs, and why they’re off

ACLs are S3’s original permission system: grant lists on each bucket and object. They allowed odd states, such as a bucket owner unable to read an object another account had uploaded. New buckets now use Bucket owner enforced. ACLs stop affecting access, the owner owns every object, and a request that tries to set one fails. Leave it that way.

Sharing without opening the bucket

  • A user needs one file for a few minutes: a presigned URL.
  • A website or downloads for everyone: CloudFront in front of a private bucket.
  • Many teams on one dataset: S3 access points or S3 Access Grants, so one bucket policy doesn’t grow without limit (it’s capped at 20 KB).
  • Another account: a bucket policy naming that account or role.

To audit, use IAM Access Analyzer, which reports buckets reachable from outside your account, and turn on CloudTrail data events where you need to know who read what.

One warning about local testing. On the moto emulator I set all four blocks, then applied a public bucket policy. moto accepted it and served an object to an anonymous curl with status 200. Real S3 is documented to reject that call. Emulators often skip authorization entirely, so a passing local test says nothing about access control.

About the video

The embed is a clip from AWS’s own re:Invent 2025 session on S3 security and access control (STG316), from 5:06 to 27:20. The chapters in that span cover continuous improvements in S3’s security defaults, fundamental security practices and scaling access control. The full talk goes on to testing changes, organization-level controls, logging and recovery. I judged it from chapters and description only, and there’s no audio-language flag on the video; the title, description and captions are English.

The JSON policies were written for this lesson and weren’t applied to AWS. Defaults, the four settings and the ACL behaviour come from the S3 user guide, checked in November 2026.

Check yourself

  1. 01A role in account A has an identity policy allowing s3:GetObject on a bucket in account B. The bucket has no policy. Can it read?

    No. Cross-account access needs an allow on both sides: account A grants the role, and account B's bucket policy (or an access point or Access Grant) grants account A or that role.

  2. 02A policy allows s3:ListBucket and s3:GetObject on arn:aws:s3:::reports/*. Downloads work but listing is denied. Why?

    ListBucket is an action on the bucket itself, whose ARN is arn:aws:s3:::reports with no slash. The statement only names objects.

  3. 03Someone adds a bucket policy with Principal set to an asterisk, and the account has all four Block Public Access settings on. What happens?

    BlockPublicPolicy rejects the PutBucketPolicy call. And had such a policy already existed, RestrictPublicBuckets would stop the public from using it.

  4. 04Why are ACLs disabled on new buckets?

    ACLs are a second, per-object permission system that is hard to audit. With Bucket owner enforced, the bucket owner owns every object and policies alone decide access.

Go deeper

Notes

Private to you

Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark