Amazon S3 static website served by Amazon CloudFront with Origin Access Control (OAC)

Amazon CloudFront → Amazon S3

Serve a static website hosted in a private Amazon S3 bucket through an Amazon CloudFront distribution using Origin Access Control (OAC).

This CDK app creates a private S3 bucket, uploads a sample index.html to it, and creates a CloudFront distribution in front of the bucket.
CloudFront reads the bucket content through Origin Access Control (OAC), so the bucket stays private and is only accessible via CloudFront.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/s3-cloudfront-oac-cdk-python

Deploy

cdk deploy


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack: cdk destroy.

Created by:

Faraz Haider

Faraz Haider

I am a Associate Cloud Consultant with Amazon Web Services and Serverless Enthusiast.

Follow on LinkedIn