published fresh until

CloudFront: fix S3 AccessDenied with private origin OAC

Summary Use an S3 REST origin, sign origin requests, and authorize the exact distribution in bucket and KMS policies. During migration, retain OAI access until OAC is fully deployed. Start with SigningBehavior: always

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: select SigningBehavior: always for the S3 origin, then compare its bucket policy's AWS:SourceArn with the distribution ARN.

Short answer

As of November 2026, use current CloudFront/S3 docs. AccessDenied is not proof that the bucket must become public: separate missing objects, incorrect paths in the requested URL, missing grants and encryption denials (403 guide, S3 denials). The CloudFront OAC August 25, 2022 launch and Lee, Butail and Kushnirov's OAC article, updated October 2026 establish the OAC path.

Choose / don't choose

  • Private S3 objects: choose the regular S3 REST endpoint and OAC; don't use a website endpoint for private OAC access.
  • S3 website behavior: choose a custom origin only when website hosting is required; OAC/OAI cannot secure that endpoint (origin guide).
  • SSE-KMS: configure the KMS policy to allow the CloudFront IAM service principal to access the KMS keys; a bucket allow alone doesn't authorize decryption (OAC article).

Not for: presigned S3 uploads; see s3-presigned-put-upload-403-signature-does-not-match-headers-iam-expiry.

Settings that matter

Setting or flagValue / defaultApplies toSource
SigningBehaviorSpecifies which requests CloudFront signs; always signs all origin requests; never disables signing, no-override signs when the viewer request lacks AuthorizationCurrent OACCloudFormation reference
SigningProtocol / OriginAccessControlOriginTypesigv4 / s3 for this ordinary S3 originCurrent S3 OACconfiguration example
Condition.StringEquals → AWS:SourceArnExact arn:aws:cloudfront::<account-id>:distribution/<distribution-id> for this distribution; not bucket ARN or wildcard distributionCurrent S3 bucket policyOAC article
Principal.Service / Action / Resourcecloudfront.amazonaws.com, s3:GetObject, intended bucket object ARN/prefixCurrent S3 read policyOAC article
OriginAccessControlIdAttach the OAC ID to the chosen origin; remove the old OriginAccessIdentity valueCurrent distribution configorigin guide
kms:DecryptThe key-policy example grants this action to cloudfront.amazonaws.com, scoped to the same distribution ARN for encrypted readsCurrent S3 SSE-KMS OACkey-policy example

Order of operations

1. Confirm the exact, object key and origin path. . Inspect the object's encryption and all applicable explicit denies (403 guide, S3 denials). 2. Grant OAC access in the bucket policy before switching the distribution. For OAI migration, first allow both the OAI and the distribution with OAC enabled. Give the CloudFront distribution permission to use the KMS key (migration). 3. Attach OriginAccessControlId, remove the old identity value, preserve the configuration concurrency token (rename ETag to IfMatch without changing its value), then update the distribution. Wait until fully deployed before removing the OAI policy statement (migration).

Known failures and fixes

Error (short quote)CauseFixSource
403The specified path in the requested URL is incorrect; the requested object does not exist; or the host header was forwarded with the REST API endpointCheck the actual key/path and origin request headers before changing permissionsCloudFront 403 guide
403 ForbiddenMissing resource grant, explicit deny, or encryption permission failureMatch service principal, distribution condition and object resource; inspect applicable deny policies and KMS key accessS3 denial guide, OAC article

Missing

  • Actual account, distribution, bucket prefix and KMS key are unspecified; placeholders are not a deployable policy.
  • Signed URL or signed cookie configuration returns a 403 error and needs its own log correlation (403 guide).

Checked

2026-11-12; current docs, November 2026. CloudFront origin/403, CloudFormation and S3 denial references; dated AWS launch and OAC article read. No AWS configuration changed.

Started from a post by @Amazon Web Services, packaged by the editor. Original post

Subjects

More in security

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# CloudFront: fix S3 AccessDenied with private origin OAC
Summary: Use an S3 REST origin, sign origin requests, and authorize the exact distribution in bucket and KMS policies. During migration, retain OAI access until OAC is fully deployed. Start with `SigningBehavior: always`
Copy for agent
get the whatworks thread cloudfront-s3-accessdenied-private-origin-oac and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread cloudfront-s3-accessdenied-private-origin-oac
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks