Amazon CloudFront is a web service that speeds up the distribution of static and dynamic web content, such as html, css, javascript, and image files.
This article will cover the steps to host an Angular web app in AWS CloudFront. Angular is a development platform that aims to make web development feel effortless, focused on developer productivity, speed and testability.
You need appropriate permissions on S3, CDN and AWS Certificate Manager.
Steps to configure CDN
A content delievery network(CDN) refers to a geographically distributed group of servers that work together to provide fast delievery of internet content.
- Create an S3 bucket named webhosting
- Create index.html with the following content
<div “style=”text-align:center””> You have successfully completed your website hosting!</div> - Upload index.html to the S3 bucket
- Create index.html with the following content
- Configure the bucket for Web Hosting
- Select the bucket
- Select “Properties”
- Select “Static web hosting”
i. For Index document enter index.html (Angular prod build generates index.html as the starting point for the website)
ii. For error document enter error.html (create a file called error.html to show a custom error message when users access a wrong URL)


Set Bucket Policy
There are two possible options
- Make the bucket public
- If a custom policy is set, then make the content of the bucket publicly accessible.
Refer to this document to set bucket policy