Protect Private Content S3 using AWS CloudFront

Nhan Cao
6 min readMar 14, 2020

— —

AWS SA Fundamentals

AWS S3 with Nodejs practice

Amazon S3 + Amazon CloudFront

As the title, you have a resource on S3, and you don't want it can be accessed on a simple URL directly, it just only accesses from your authorized application. We try with the signed URL and signed cookies.

First, prepare S3 content

create S3 Bucket and upload 2 files avatar.jpg and index.html (https://github.com/nhancv/nc-aws/tree/master/aws_examples/res/cloudfront_s3)

Fill the bucket name to create S3 Bucket, Uncheck `Block all public access` and Confirm to acknowledge that, then leave the rest of the settings to their default values.

Upload 2 example files

Update Bucket Policy and Save

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "nhancv",
"Effect": "Allow"…

--

--