Configure Amazon CloudFront
Using the AWS Management Console, we will create a CloudFront distribution, and configure it to serve the S3 bucket we previously created.
- Open the Amazon CloudFront console at https://console.aws.amazon.com/cloudfront/home .
- From the console dashboard, click Create distribution.

- Specify the following settings for the distribution:
- In the Origin domain field Select the S3 bucket you created previously.
- In the Origin access, choose Legacy access identities
- In the Bucket policy, choose Yes, update the bucket policy
- Choose Create new OAI


- Another field, let it default
- In the Settings
- Choose Use North America, Europe, Asia, Middle East, and Africa because, Vietnam in Asia
- In the Default root object - optional, input file already upload on S3 (Fx: index.html)
- Scroll down last page, choose Create distribution

- After CloudFront creates your distribution which may take approximately a few minutes
- Column Status & Column Last modified has infomation like below.
- Lick on ID to get Distribution domain name

- When your distribution is deployed, confirm that you can access your content using your new CloudFront Distribution domain name which you can see in the console. Copy the Domain Name into a web browser to test.

Result like below

For more information, see Testing a Web Distribution in the CloudFront documentation.
- Check the period of time for brower loading index.html by Distribution domain name of CloudFront
- Lick rightmost button , choose Inspect
- On the right, choose » and choose Network
- Lick the icon reload page

- Time from 110 milliseconds (when viewing html files via S3-Object URL) has been reduced to 9 milliseconds by to access via CloudFront! Imagine: your static web is hosted in Region US & has end user in Asian, the time to return results after 1 mouse click can be up to a few seconds or tens of seconds, that - will affect the user experience! But with CloudFront speed will always be optimal.
- Check the location of CloudFront Pop(Points of Presence)
- Click one time in domain name central page
- Check POP - Cloudfront, i request from Ho Chi Minh - so POP is: SGN50-P1 (with SGN is Saigon)

- You now have content in a private S3 bucket, that only CloudFront has secure access to. CloudFront then serves the requests, effectively becoming a secure, reliable static hosting service with additional features available such as custom certificates and alternate domain names .
For more information on configuring CloudFront, see Viewing and Updating CloudFront Distributions in the CloudFront documentation.