{"id":729,"date":"2026-11-01T09:06:53","date_gmt":"2026-11-01T07:06:53","guid":{"rendered":"https:\/\/john-nessime.com\/blog\/?p=729"},"modified":"2026-11-01T09:06:53","modified_gmt":"2026-11-01T07:06:53","slug":"serve-s3-images-without-public-read","status":"publish","type":"post","link":"https:\/\/john-nessime.com\/blog\/cloud-computing\/serve-s3-images-without-public-read\/","title":{"rendered":"Serving Millions of Images From S3 Without public-read"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Open the network tab on a page that is supposed to sit behind a CDN and read the image hostnames. If some of them come back from <code>bucket-name.s3.amazonaws.com<\/code> instead of your distribution, the CDN in front of those images is decoration. Those bytes are leaving S3 directly, and nothing you configure at the edge applies to them.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The cause is almost always the same: the objects are public. Somebody set <code>public-read<\/code> during a migration, the CDN arrived later, and nobody closed the original door. The site still loads, so the problem stays invisible until an auditor asks who can read the bucket, or until the bill arrives shaped differently from the traffic graph.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This post covers how to serve S3 images without public-read at real volume: the access path that replaces public objects, the error-handling trap that turns missing thumbnails into origin load, cache design when the object count runs into the millions, and what changes when some images have to be private per user.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Public objects do not just leak, they make your CDN optional<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The security argument against public buckets is worn out and people have stopped hearing it. The operational argument lands harder, because it costs money every month. When an object is readable by anyone there are two working paths to the same bytes, and whatever share of your traffic takes the direct one loses four things at once:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>The cache.<\/strong> Direct requests never touch an edge location, so they never appear in your cache hit ratio. The dashboard says the cache is healthy because it only counts traffic that arrived.<\/li>\n\n<li><strong>Your response headers.<\/strong> A response headers policy applies at the edge. S3 serves whatever metadata was written at upload time, so headers you added later are simply not there on the bypass path.<\/li>\n\n<li><strong>Revocation.<\/strong> A public URL that has been scraped stays valid until you rename the key or change the bucket. There is no expiry to reach for and no signature to stop honouring.<\/li>\n\n<li><strong>Predictable billing.<\/strong> Bytes leaving S3 for the internet bill as S3 data transfer. The same bytes leaving a CloudFront edge bill as CloudFront data transfer, and the origin leg from an AWS origin is not billed at all. Two paths, two rate cards, one invoice that no longer matches your traffic chart.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">There is a second reason to stop reaching for that ACL: on a new bucket it will not work. S3 Object Ownership now defaults to <em>bucket owner enforced<\/em>, which disables ACLs entirely. A <code>PutObject<\/code> carrying <code>--acl public-read<\/code> comes back with a 400 and the error code <code>AccessControlListNotSupported<\/code>. Plenty of tutorials still open with that flag and now fail at step one.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Serve S3 images without public-read using origin access control<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Origin access control lets CloudFront, and only CloudFront, read a private bucket. CloudFront signs each origin request with SigV4 using short-lived credentials, and the bucket policy trusts the CloudFront service principal for one named distribution. The order of operations matters more than any individual step: grant the permission before you attach the OAC, or you get a window where the distribution signs requests the bucket does not yet trust and every viewer sees a 403.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Confirm ACLs are off, so access is decided by policy alone rather than two overlapping systems.<\/li>\n\n<li>Turn on all four Block Public Access settings at the bucket, and at the account if nothing there needs to be public.<\/li>\n\n<li>Create the distribution against the bucket&#8217;s REST endpoint. Not the website endpoint.<\/li>\n\n<li>Write the bucket policy trusting the CloudFront service principal, scoped to that distribution&#8217;s ARN.<\/li>\n\n<li>Attach the OAC with signing behaviour set to always sign.<\/li>\n\n<li>Verify from a machine with no AWS credentials that the direct URL fails and the distribution URL works.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Start by finding out what the bucket does today. If ownership comes back as <code>BucketOwnerEnforced<\/code>, ACLs are already disabled; if the second call errors because no configuration exists, that is an answer too.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>aws s3api get-bucket-ownership-controls --bucket amzn-s3-demo-bucket\naws s3api get-public-access-block --bucket amzn-s3-demo-bucket<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">The bucket policy, and why the condition is the whole point<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Sid\": \"AllowCloudFrontServicePrincipalReadOnly\",\n      \"Effect\": \"Allow\",\n      \"Principal\": { \"Service\": \"cloudfront.amazonaws.com\" },\n      \"Action\": \"s3:GetObject\",\n      \"Resource\": \"arn:aws:s3:::amzn-s3-demo-bucket\/*\",\n      \"Condition\": {\n        \"StringEquals\": {\n          \"AWS:SourceArn\": \"arn:aws:cloudfront::111122223333:distribution\/EXAMPLEDIST\"\n        }\n      }\n    }\n  ]\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Drop the <code>Condition<\/code> block and the policy still works, which is exactly why people drop it. What you have then is a bucket that trusts <em>every<\/em> CloudFront distribution in the world, including one somebody else creates this afternoon pointing at your bucket name. That is the confused deputy shape: the service is authorised, the caller behind it is never checked. The source ARN condition pins the trust to one distribution in one account.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before you paste that in, read it back the way an attacker would. The free <a href=\"https:\/\/john-nessime.com\/tools\/aws-iam-policy-checker\/\">AWS IAM policy checker<\/a> here takes a bucket or IAM policy and shows which wildcards grant more than they look like. No signup, and it is the fastest sanity check I know for a policy about to become load-bearing.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Verify from outside<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># should return 403\ncurl -sI https:\/\/amzn-s3-demo-bucket.s3.eu-west-1.amazonaws.com\/img\/hero.jpg\n\n# should return 200\ncurl -sI https:\/\/d111111abcdef8.cloudfront.net\/img\/hero.jpg<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Run both from somewhere with no AWS credentials configured. It is easy to test from your laptop, get a 200 from the S3 URL, and panic before realising you signed the request with your admin profile.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Two constraints catch people here. OAC works only with the regular bucket endpoint, so index-document and redirect behaviour from the S3 website endpoint has to move into a CloudFront Function. And SSE-KMS objects need their own statement in the key policy letting the CloudFront service principal use the key, scoped with the same condition. A correct bucket policy plus a silent key policy produces a 403 identical to a permissions typo.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The failure family nobody plans for: 403s that should be 404s<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This is the one that bites at image scale, and it is invisible in a test with ten files. When a principal holds <code>s3:GetObject<\/code> but not <code>s3:ListBucket<\/code>, S3 answers a request for a key that does not exist with 403 rather than 404. That is deliberate. Without list permission, saying &#8220;not found&#8221; would confirm that other keys do exist. The standard OAC policy grants only <code>GetObject<\/code>, so every missing image comes back as Access Denied.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">At a few hundred images you never notice. At a few million, where thumbnail URLs come from a naming convention and some sizes were never rendered, three problems compound: your custom error response for 404 never fires because nothing returns 404, your monitoring fills with permission errors that are not permission errors, and the body S3 returns is XML, so the browser shows a broken image rather than your placeholder. Two honest options:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Add <code>s3:ListBucket<\/code> on the bucket ARN<\/strong> so missing keys return a real 404 and your custom error response can take over. The trade-off is that a request to the distribution root can then reach a list operation, so pair it with a function or behaviour that refuses or rewrites <code>\/<\/code>.<\/li>\n\n<li><strong>Keep the policy narrow<\/strong> and map 403 to your placeholder with a custom error response. Simpler, and you accept that status code alone no longer distinguishes missing from forbidden.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Either way, set the error caching duration deliberately. Cached for zero seconds, every request for a thumbnail that was never generated is a fresh origin fetch, and a crawler walking a broken URL pattern becomes a self-inflicted origin flood with nothing in your application logs to explain it. Negative caching is not an optimisation here. It is what stands between one bad URL template and a very odd Tuesday.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Cache design when the object count is in the millions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Locking the bucket is the easy half. Making the edge absorb the traffic is where volume shows up.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Cache-Control is written at upload time, and you will forget it<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">For an S3 origin, cache lifetime comes from object metadata, written when the object is written. There is no bulk edit later that is not a copy of every object, so put this in the upload path on day one.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>aws s3 cp .\/hero.jpg s3:\/\/amzn-s3-demo-bucket\/img\/hero.jpg \n  --cache-control \"public, max-age=31536000, immutable\"<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Content-addressed keys instead of invalidations<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If the key contains a hash of the bytes, the object never changes and <code>immutable<\/code> is honest. Publishing a new version writes a new key and the old one ages out on its own: no invalidation, no propagation wait, no billed paths. Invalidation exists for cases you did not design for. Treating it as a deployment step is how teams pay for thousands of paths a month and still serve stale images while it propagates.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Keep the cache key small<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Every dimension in the cache key multiplies the copies the edge has to store and fill. Three habits do most of the damage:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Forwarding all query strings.<\/strong> Campaign and analytics parameters do not change the bytes but they do fragment the cache. Include only parameters that select a different image, such as a width used by a resizing function.<\/li>\n\n<li><strong>Putting <code>Accept<\/code> in the key raw.<\/strong> Serving WebP or AVIF by content negotiation needs <code>Accept<\/code> in the key, but browsers send dozens of variations of that header. Normalise it in a CloudFront Function to a small set of values, then key on the result.<\/li>\n\n<li><strong>Chasing compression.<\/strong> JPEG, PNG, WebP and AVIF are already compressed. Brotli at the edge buys nothing on image bytes and is worth attention only for the SVG and JSON on the same distribution.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Origin Shield, and when it is just a surcharge<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Origin Shield adds a designated regional caching layer that edge misses funnel through, so a cold object is fetched from the bucket once rather than once per region, billed per request on top of everything else. It pays for itself when origin misses are the problem: a long tail of images, an audience spread across continents, several distributions sharing one bucket. If the hit ratio is already high and the catalogue is small and hot, it buys nothing. Look at origin request volume before enabling it, not after.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">When some of the images are genuinely private<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Locking the bucket makes the origin private. It does not make the URLs private, because anyone holding a distribution URL can fetch it. Per-customer images need signatures at the viewer edge as well.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Signed URLs<\/strong> suit one object at a time: a download link, an invoice scan, a single generated asset.<\/li>\n\n<li><strong>Signed cookies<\/strong> suit a gallery or album under one path prefix, where minting a URL per image would be absurd.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Use trusted key groups rather than legacy account-level key pairs: they hold public keys you manage, rotating them does not need root credentials, and different groups can attach to different behaviours. Split public and private content by path prefix into separate cache behaviours, so public images do not pay for a signature check and private ones cannot be reached without one.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then weigh signature lifetime against page lifetime. A signature expiring in five minutes strands a page the user left open, and that failure looks like an outage to them and like nothing at all to you. Presigned S3 URLs are the other tempting answer, and they reintroduce the exact problem this post is about: they point at the bucket, bypass the edge, and bill as S3 egress.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What this shape actually costs<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Rates change, so work with the mechanism rather than a number you read in a blog post.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Data transferred from an AWS origin such as S3 to CloudFront edge locations is not charged. A cache miss costs you an S3 request, not egress.<\/li>\n\n<li>You pay for transfer out from the edge to the viewer, plus a per-request charge that varies by region and runs higher for HTTPS than HTTP.<\/li>\n\n<li>At millions of small images, request charges are a real share of the bill rather than a rounding error. Object size decides whether transfer or requests dominate.<\/li>\n\n<li>Cache hit ratio is the only lever that moves origin requests, origin load and edge behaviour together. Everything else is second order.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">For a sense of the shape before committing, the <a href=\"https:\/\/john-nessime.com\/tools\/aws-cost-estimator\/\">AWS cost estimator<\/a> on this site walks through the parts of a monthly bill people forget, egress included.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">None of this assumes AWS is the right home for the images. If the origin is a VPS at a provider like Contabo or InterServer, or object storage with no egress fee such as Backblaze B2 or Cloudflare R2, that provider bills the origin leg and the arithmetic changes. The access-control principle survives the move: storage should be reachable only by the CDN, whoever provides each half.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting the setup<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Every object returns AccessDenied through the distribution.<\/strong> Compare the distribution ID in the policy condition with the real one, character by character, and confirm signing is set to always sign.<\/li>\n\n<li><strong>The distribution works and so does the direct S3 URL.<\/strong> Block Public Access is not fully on, or a statement with <code>\"Principal\": \"*\"<\/code> still sits underneath your new one.<\/li>\n\n<li><strong>Uploads fail with &#8220;The bucket does not allow ACLs&#8221;.<\/strong> Something upstream still sends a canned ACL. Drop the flag or SDK parameter; with ownership enforced you do not need it.<\/li>\n\n<li><strong>Only encrypted objects 403.<\/strong> The KMS key policy has no statement for the CloudFront service principal. A bucket policy alone is not enough for SSE-KMS.<\/li>\n\n<li><strong>Only some objects 403.<\/strong> Check ownership on the failing keys, and remember key names are case sensitive.<\/li>\n\n<li><strong>Everything works but the custom domain does not.<\/strong> The alternate domain name has to be on the distribution and the certificate in the region CloudFront reads certificates from. The <a href=\"https:\/\/john-nessime.com\/tools\/ssl-certificate-checker\/\">SSL certificate checker<\/a> confirms the chain and hostname coverage a browser will actually see.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Migrating from a legacy origin access identity? Keep both principals allowed in the bucket policy while you switch, then remove the OAI statement once the distribution finishes deploying. Removing it first is how you take an outage during a security improvement.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Common mistakes<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Locking the bucket while old public S3 URLs are still hard-coded in a database, an email template or a shipped mobile app.<\/li>\n\n<li>Omitting the source ARN condition, which turns &#8220;only CloudFront&#8221; into &#8220;any CloudFront&#8221;.<\/li>\n\n<li>Leaving error caching at zero, so every missing thumbnail is a fresh origin request forever.<\/li>\n\n<li>Uploading without <code>Cache-Control<\/code> and relying on the distribution default, then wondering why a TTL change did nothing.<\/li>\n\n<li>Using invalidation as a release step instead of putting a hash in the key.<\/li>\n\n<li>Signing every image, including the marketing site&#8217;s, and losing cache efficiency to protect nothing.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Best practices worth the effort<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Turn Block Public Access on at the account level, then grant exceptions deliberately rather than the other way round.<\/li>\n\n<li>Keep one distribution per bucket where you can, so the source ARN condition stays a single value and a policy mistake has a small blast radius.<\/li>\n\n<li>Separate public and private prefixes into different cache behaviours from the start. Retrofitting that split means changing URLs.<\/li>\n\n<li>Alarm on origin request rate, not only error rate. A cache that quietly stops working looks fine on an error dashboard.<\/li>\n\n<li>Re-read the bucket policy after every change. These policies accumulate statements and nobody deletes the old ones.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">FAQ<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Can I still make an S3 bucket public if I want to?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">On an older bucket with ACLs enabled, yes. On a new one you would have to move Object Ownership away from the enforced default and disable Block Public Access, which is several deliberate steps to arrive somewhere worse. If the images are genuinely public and there is no CDN in front, the fix is to add the CDN.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Is origin access identity still supported?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">It still works, and AWS documents it as legacy. OAC covers cases OAI does not, including SSE-KMS objects and newer regions. For anything new there is no reason to reach for OAI, and migrating is a bucket policy edit followed by an origin setting, in that order.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Does OAC work with an S3 static website endpoint?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No. The website endpoint is treated as a custom origin and cannot be secured with OAC or OAI. Move index-document and redirect logic to a CloudFront Function against the regular bucket endpoint instead.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How do I stop hotlinking once the bucket is private?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Private origin access does not address hotlinking, because the distribution URL is still open to whoever holds it. Referer checks in a CloudFront Function are easy and easy to forge. Signed URLs or cookies are the only mechanism that binds access to a session. Decide whether hotlinking is a cost problem or a rights problem first.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Do signed URLs hurt cache hit ratio?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Less than people expect, because CloudFront validates the signature parameters at the edge rather than passing them to the origin as ordinary query strings. The bigger risk is the browser: mint a fresh signature on every page render and the viewer sees a new URL each time, defeating their cache even when the edge cache is fine.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What happens to existing public URLs when I lock the bucket?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">They start returning 403 immediately. There is no redirect available at the S3 layer, so the safe sequence is to move every reference to the distribution hostname first, watch S3 access logs until direct requests stop, then close the bucket.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The one thing to take away<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You can serve S3 images without public-read at any volume you like, and the setup is a bucket policy, an origin access control and a signing behaviour. That part is an afternoon.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What matters is why it is worth doing beyond the audit checkbox. A public object gives every viewer a second path to your bytes, one that skips your cache, ignores your headers, cannot be revoked and bills on a different rate card. Closing it is what makes the CDN in front of your images real rather than nominal. Everything after that is tuning a system that at least has one front door.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Need a second pair of eyes on your S3 and CloudFront setup?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Most of the work here is not writing the policy. It is working out what the current one allows, and who is still calling the old URLs. That is the kind of thing I do:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Audit bucket policies, Block Public Access and Object Ownership across an account, and map who can genuinely read each bucket.<\/li>\n\n<li>Migrate public buckets or legacy OAI distributions to origin access control without an outage window.<\/li>\n\n<li>Find the paths still bypassing the CDN using access logs rather than guesswork, and close them.<\/li>\n\n<li>Redesign cache keys, TTLs and error caching for image workloads where origin request volume drives the cost.<\/li>\n\n<li>Set up signed URLs or signed cookies with key groups, including rotation that does not need root credentials.<\/li>\n\n<li>Review SSE-KMS key policies and cross-account object ownership, and the 403s they quietly produce.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">If you would rather start with something concrete than a call, send me your bucket policy and the output of <code>aws s3api get-public-access-block<\/code>, and I will tell you what it actually permits.<\/p>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/john-nessime.com\/projects\/aws-security-review\/\">Get an AWS security review<\/a><\/div>\n\n\n\n<div class=\"wp-block-button is-style-outline is-style-outline--1\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/www.upwork.com\/freelancers\/~01f15a912ad84a6620\" target=\"_blank\" rel=\"noreferrer noopener\">Work with me on Upwork<\/a><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>A public S3 object gives every viewer a second path to your bytes, one that skips your cache, ignores your headers and bills on a different rate card. Here is how to serve S3 images without public-read at scale: origin access control, the bucket policy condition that matters, the 403-versus-404 trap that turns missing thumbnails into origin load, and cache design that survives millions of objects.<\/p>\n","protected":false},"author":1,"featured_media":1214,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25,612,107],"tags":[775,161,628,113,108,103,187,714,1031,613,537,1029,486,1030,744],"class_list":["post-729","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud-computing","category-cloud-security","category-web-performance","tag-amazon-cloudfront","tag-amazon-s3","tag-bucket-policy","tag-cache-control","tag-cdn","tag-cloud-security","tag-cost-optimization","tag-data-transfer-costs","tag-image-delivery","tag-least-privilege","tag-negative-caching","tag-origin-access-control","tag-presigned-urls","tag-signed-urls","tag-sigv4","entry","has-media"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Serve S3 Images Without public-read Using CloudFront<\/title>\n<meta name=\"description\" content=\"How to serve S3 images without public-read at scale: origin access control, the bucket policy condition, 403-vs-404 traps and cache design that holds.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/john-nessime.com\/blog\/cloud-computing\/serve-s3-images-without-public-read\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Serve S3 Images Without public-read Using CloudFront\" \/>\n<meta property=\"og:description\" content=\"How to serve S3 images without public-read at scale: origin access control, the bucket policy condition, 403-vs-404 traps and cache design that holds.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/john-nessime.com\/blog\/cloud-computing\/serve-s3-images-without-public-read\/\" \/>\n<meta property=\"og:site_name\" content=\"John Nessime\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/J.Nessime\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/J.Nessime\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-01T07:06:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/john-nessime.com\/blog\/wp-content\/uploads\/2026\/09\/serving-millions-s3-images-without-public-read.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1536\" \/>\n\t<meta property=\"og:image:height\" content=\"1024\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"John Nessime\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"John Nessime\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"14 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/cloud-computing\\\/serve-s3-images-without-public-read\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/cloud-computing\\\/serve-s3-images-without-public-read\\\/\"},\"author\":{\"name\":\"John Nessime\",\"@id\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/#\\\/schema\\\/person\\\/ede0b56d0c808f123f57d5d796902105\"},\"headline\":\"Serving Millions of Images From S3 Without public-read\",\"datePublished\":\"2026-11-01T07:06:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/cloud-computing\\\/serve-s3-images-without-public-read\\\/\"},\"wordCount\":3070,\"publisher\":{\"@id\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/#\\\/schema\\\/person\\\/ede0b56d0c808f123f57d5d796902105\"},\"image\":{\"@id\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/cloud-computing\\\/serve-s3-images-without-public-read\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/serving-millions-s3-images-without-public-read.png\",\"keywords\":[\"Amazon CloudFront\",\"Amazon S3\",\"Bucket Policy\",\"Cache Control\",\"CDN\",\"Cloud Security\",\"Cost Optimization\",\"Data Transfer Costs\",\"Image Delivery\",\"Least Privilege\",\"Negative Caching\",\"Origin Access Control\",\"Presigned URLs\",\"Signed URLs\",\"SigV4\"],\"articleSection\":[\"Cloud Computing\",\"Cloud Security\",\"Web Performance\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/cloud-computing\\\/serve-s3-images-without-public-read\\\/\",\"url\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/cloud-computing\\\/serve-s3-images-without-public-read\\\/\",\"name\":\"Serve S3 Images Without public-read Using CloudFront\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/cloud-computing\\\/serve-s3-images-without-public-read\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/cloud-computing\\\/serve-s3-images-without-public-read\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/serving-millions-s3-images-without-public-read.png\",\"datePublished\":\"2026-11-01T07:06:53+00:00\",\"description\":\"How to serve S3 images without public-read at scale: origin access control, the bucket policy condition, 403-vs-404 traps and cache design that holds.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/cloud-computing\\\/serve-s3-images-without-public-read\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/john-nessime.com\\\/blog\\\/cloud-computing\\\/serve-s3-images-without-public-read\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/cloud-computing\\\/serve-s3-images-without-public-read\\\/#primaryimage\",\"url\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/serving-millions-s3-images-without-public-read.png\",\"contentUrl\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/serving-millions-s3-images-without-public-read.png\",\"width\":1536,\"height\":1024,\"caption\":\"CloudFront delivering millions of images from a private Amazon S3 bucket using Origin Access Control without public-read permissions.\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/cloud-computing\\\/serve-s3-images-without-public-read\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Serving Millions of Images From S3 Without public-read\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/\",\"name\":\"John Nessime\",\"description\":\"Cloud, DevOps, Data &amp; AI \u2014 Built, Tested, Explained\",\"publisher\":{\"@id\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/#\\\/schema\\\/person\\\/ede0b56d0c808f123f57d5d796902105\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/#\\\/schema\\\/person\\\/ede0b56d0c808f123f57d5d796902105\",\"name\":\"John Nessime\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/cropped-jn.png\",\"url\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/cropped-jn.png\",\"contentUrl\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/cropped-jn.png\",\"width\":512,\"height\":512,\"caption\":\"John Nessime\"},\"logo\":{\"@id\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/cropped-jn.png\"},\"description\":\"AWS Certified Solutions Architect helping businesses build reliable cloud, data, reporting, and automation solutions. I help startups, agencies, and growing businesses replace manual processes and disconnected data with practical AWS architectures, clean data pipelines, useful dashboards, and maintainable automation.\",\"sameAs\":[\"https:\\\/\\\/john-nessime.com\\\/blog\",\"https:\\\/\\\/www.facebook.com\\\/J.Nessime\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/john-m-nessime\"],\"url\":\"https:\\\/\\\/john-nessime.com\\\/blog\\\/author\\\/johnnessime\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Serve S3 Images Without public-read Using CloudFront","description":"How to serve S3 images without public-read at scale: origin access control, the bucket policy condition, 403-vs-404 traps and cache design that holds.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/john-nessime.com\/blog\/cloud-computing\/serve-s3-images-without-public-read\/","og_locale":"en_US","og_type":"article","og_title":"Serve S3 Images Without public-read Using CloudFront","og_description":"How to serve S3 images without public-read at scale: origin access control, the bucket policy condition, 403-vs-404 traps and cache design that holds.","og_url":"https:\/\/john-nessime.com\/blog\/cloud-computing\/serve-s3-images-without-public-read\/","og_site_name":"John Nessime","article_publisher":"https:\/\/www.facebook.com\/J.Nessime","article_author":"https:\/\/www.facebook.com\/J.Nessime","article_published_time":"2026-11-01T07:06:53+00:00","og_image":[{"width":1536,"height":1024,"url":"https:\/\/john-nessime.com\/blog\/wp-content\/uploads\/2026\/09\/serving-millions-s3-images-without-public-read.png","type":"image\/png"}],"author":"John Nessime","twitter_card":"summary_large_image","twitter_misc":{"Written by":"John Nessime","Est. reading time":"14 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/john-nessime.com\/blog\/cloud-computing\/serve-s3-images-without-public-read\/#article","isPartOf":{"@id":"https:\/\/john-nessime.com\/blog\/cloud-computing\/serve-s3-images-without-public-read\/"},"author":{"name":"John Nessime","@id":"https:\/\/john-nessime.com\/blog\/#\/schema\/person\/ede0b56d0c808f123f57d5d796902105"},"headline":"Serving Millions of Images From S3 Without public-read","datePublished":"2026-11-01T07:06:53+00:00","mainEntityOfPage":{"@id":"https:\/\/john-nessime.com\/blog\/cloud-computing\/serve-s3-images-without-public-read\/"},"wordCount":3070,"publisher":{"@id":"https:\/\/john-nessime.com\/blog\/#\/schema\/person\/ede0b56d0c808f123f57d5d796902105"},"image":{"@id":"https:\/\/john-nessime.com\/blog\/cloud-computing\/serve-s3-images-without-public-read\/#primaryimage"},"thumbnailUrl":"https:\/\/john-nessime.com\/blog\/wp-content\/uploads\/2026\/09\/serving-millions-s3-images-without-public-read.png","keywords":["Amazon CloudFront","Amazon S3","Bucket Policy","Cache Control","CDN","Cloud Security","Cost Optimization","Data Transfer Costs","Image Delivery","Least Privilege","Negative Caching","Origin Access Control","Presigned URLs","Signed URLs","SigV4"],"articleSection":["Cloud Computing","Cloud Security","Web Performance"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/john-nessime.com\/blog\/cloud-computing\/serve-s3-images-without-public-read\/","url":"https:\/\/john-nessime.com\/blog\/cloud-computing\/serve-s3-images-without-public-read\/","name":"Serve S3 Images Without public-read Using CloudFront","isPartOf":{"@id":"https:\/\/john-nessime.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/john-nessime.com\/blog\/cloud-computing\/serve-s3-images-without-public-read\/#primaryimage"},"image":{"@id":"https:\/\/john-nessime.com\/blog\/cloud-computing\/serve-s3-images-without-public-read\/#primaryimage"},"thumbnailUrl":"https:\/\/john-nessime.com\/blog\/wp-content\/uploads\/2026\/09\/serving-millions-s3-images-without-public-read.png","datePublished":"2026-11-01T07:06:53+00:00","description":"How to serve S3 images without public-read at scale: origin access control, the bucket policy condition, 403-vs-404 traps and cache design that holds.","breadcrumb":{"@id":"https:\/\/john-nessime.com\/blog\/cloud-computing\/serve-s3-images-without-public-read\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/john-nessime.com\/blog\/cloud-computing\/serve-s3-images-without-public-read\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/john-nessime.com\/blog\/cloud-computing\/serve-s3-images-without-public-read\/#primaryimage","url":"https:\/\/john-nessime.com\/blog\/wp-content\/uploads\/2026\/09\/serving-millions-s3-images-without-public-read.png","contentUrl":"https:\/\/john-nessime.com\/blog\/wp-content\/uploads\/2026\/09\/serving-millions-s3-images-without-public-read.png","width":1536,"height":1024,"caption":"CloudFront delivering millions of images from a private Amazon S3 bucket using Origin Access Control without public-read permissions."},{"@type":"BreadcrumbList","@id":"https:\/\/john-nessime.com\/blog\/cloud-computing\/serve-s3-images-without-public-read\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/john-nessime.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Serving Millions of Images From S3 Without public-read"}]},{"@type":"WebSite","@id":"https:\/\/john-nessime.com\/blog\/#website","url":"https:\/\/john-nessime.com\/blog\/","name":"John Nessime","description":"Cloud, DevOps, Data &amp; AI \u2014 Built, Tested, Explained","publisher":{"@id":"https:\/\/john-nessime.com\/blog\/#\/schema\/person\/ede0b56d0c808f123f57d5d796902105"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/john-nessime.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/john-nessime.com\/blog\/#\/schema\/person\/ede0b56d0c808f123f57d5d796902105","name":"John Nessime","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/john-nessime.com\/blog\/wp-content\/uploads\/2026\/07\/cropped-jn.png","url":"https:\/\/john-nessime.com\/blog\/wp-content\/uploads\/2026\/07\/cropped-jn.png","contentUrl":"https:\/\/john-nessime.com\/blog\/wp-content\/uploads\/2026\/07\/cropped-jn.png","width":512,"height":512,"caption":"John Nessime"},"logo":{"@id":"https:\/\/john-nessime.com\/blog\/wp-content\/uploads\/2026\/07\/cropped-jn.png"},"description":"AWS Certified Solutions Architect helping businesses build reliable cloud, data, reporting, and automation solutions. I help startups, agencies, and growing businesses replace manual processes and disconnected data with practical AWS architectures, clean data pipelines, useful dashboards, and maintainable automation.","sameAs":["https:\/\/john-nessime.com\/blog","https:\/\/www.facebook.com\/J.Nessime","https:\/\/www.linkedin.com\/in\/john-m-nessime"],"url":"https:\/\/john-nessime.com\/blog\/author\/johnnessime\/"}]}},"_links":{"self":[{"href":"https:\/\/john-nessime.com\/blog\/wp-json\/wp\/v2\/posts\/729","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/john-nessime.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/john-nessime.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/john-nessime.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/john-nessime.com\/blog\/wp-json\/wp\/v2\/comments?post=729"}],"version-history":[{"count":1,"href":"https:\/\/john-nessime.com\/blog\/wp-json\/wp\/v2\/posts\/729\/revisions"}],"predecessor-version":[{"id":731,"href":"https:\/\/john-nessime.com\/blog\/wp-json\/wp\/v2\/posts\/729\/revisions\/731"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/john-nessime.com\/blog\/wp-json\/wp\/v2\/media\/1214"}],"wp:attachment":[{"href":"https:\/\/john-nessime.com\/blog\/wp-json\/wp\/v2\/media?parent=729"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/john-nessime.com\/blog\/wp-json\/wp\/v2\/categories?post=729"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/john-nessime.com\/blog\/wp-json\/wp\/v2\/tags?post=729"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}