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.
- Click Get Started in the Web section.
- Specify the following settings for the distribution:
- In the Origin Domain Name field Select the S3 bucket you created previously.
- In Restrict Bucket Access click the Yes radio then click Create a New Identity.
- Click the Yes, Update Bucket Policy Button.
- Scroll down to the Distribution Settings section, in the Default Root Object field enter index.html
- Click Create Distribution.
- To return to the main CloudFront page click Distributions from the left navigation menu.
- For more information on the other configuration options, see Values That You Specify When You Create or Update a Web Distribution in the CloudFront documentation.
- After CloudFront creates your distribution which may take approximately 10 minutes, the value of the Status column for your distribution will change from In Progress to Deployed.
- When your distribution is deployed, confirm that you can access your content using your new CloudFront Domain Name which you can see in the console. Copy the Domain Name into a web browser to test.
For more information, see Testing a Web Distribution in the CloudFront documentation.
- 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.