“ I have checked the documents of AWS for serving an s3-hosted application via amazon cloudfront. Amazon cloudfront makes it easy to fetch the content and deliver it in the appropriate location. In terms of cost, the solution is cheaper and secure.”

A CloudFront distribution is a configuration in Amazon cloudfront(AWS’s content delivery network) that tells CloudFront which origin serves to fetch content from and how to deliver that content through global edge locations.

In this post, you will experience serving an s3-hosted application via amazon cloudfront. Here I have created a s3 bucket with upload of index.html file and created a cloudfront distribution for origin as s3 to faster the content delivered on cloudfront domain of application.

Architecture Overview


The architecture diagram shows the overall deployment architecture with data flow, amazon cloudfront, s3 bucket and application.

Solution Overview

The blog post consists of the following phases:

  1. Upload the index.html File in Amazon S3
  2. Creation of CloudFront Distribution in Amazon CloudFront
  3. Output of App in CloudFront Distribution Domain

Phase 1: Upload the index.html File in Amazon S3

  1. Open the Amazon S3 console, click on the get started. Upload the index.html file and block the public access.

Phase 2: Creation of CloudFront Distribution in Amazon CloudFront

  1. Open the Amazon CloudFront console, click on create a cloudfront distribution. Add a distribution name with distribution type. Select origin type as Amazon S3 and S3 origin with default recommended origin settings. Once the distribution starts to create, it will show the status as deploying mode. Also define the default root object as index.html and once the deploy completes, we can see the date and timestamp on it.

Phase 3: Output of App in CloudFront Distribution Domain

Clean-up

Delete of s3 bucket and cloudfront distribution.

Pricing

I review the pricing and estimated cost of this example.

Cost of Amazon CloudFront =

CloudFront Flat-Rate Plans CloudFrontPlan = $0.00 per Free plan for 0.002 Count = $0.00

Cost of Simple Storage Service = $0.00

Total Cost = $0.00

Summary

In this post, I showed “serving an s3-hosted application via amazon cloudfront”.

For more details on Amazon CloudFront, Checkout Get started Amazon CloudFront, open the Amazon CloudFront console. To learn more, read the Amazon CloudFront documentation.

Thanks for reading!

Connect with me: Linkedin