Set up AWS CloudFront
Amazon CloudFront is a content delivery network (CDN) service that helps us distribute static and dynamic content easily, reliably, with high performance, security, and ease of use for developers. In this section, we will use CloudFront to distribute content from the S3 storage.
- Go to AWS Management Console
- Find and select CloudFront or you can select it on the main screen

- In the CloudFront interface, select Create distribution

- In the Create CloudFront interface
- Select the Origin Domain as the S3 you just created
- The Name will be generated automatically

- In the Origin access section, select Origin access control setting
- Next, select Create new OAC

- In the OAC creation interface
- In the name section, enter
serverless-web-application-on-aws-fcj.s3.us-east.amazonaws.com-1
- Select Create

- In the Web Application Firewall section, select Do not enable security protections

- Keep the remaining sections as default and scroll to the bottom of the page, select Create distribution

- After creation, select Copy policy

- Go back to the created S3 Bucket
- Go to the Permissions tab
- In the Bucket Policy section, select Edit
- In the Edit bucket policy interface, paste the copied policy
- Click Save changes

- Switch to CloudFront, go to the Setting section, select Edit

- Scroll down to the Default root object section, enter
index.html
. Then click Save changes
