To read about what is CloudFront, see the following answer: What is CloudFront?
To use CloudFront with s3, you should carry out the following steps:
- First, open up your CloudFront console, select “Create Distribution” and click the “Get Started” button, which is under the Web section.
- Then you will see a set of features on your screen that you can modify. Here, you need to configure some settings. If you don’t know what the settings are about, use the information icon to the right to understand why this or that setting exists.
- Next, you will have to set up the Origin Domain Name. To do so, choose your S3 bucket’s REST API endpoint from the drop-down menu. The other way to carry out this task is to enter your S3 bucket’s website endpoint. See more information here Key differences between a website endpoint and a REST API endpoint.
- Choose HTTP and HTTPS for Viewer Protocol Policy.
Choose “Create Distribution” only if you’re not using your own custom domain name with CloudFront. This way you will complete the process. However, if you are using your own custom domain name, carry out additional steps before creating the distribution:
- Type your custom domain for Alternate Domain Names (CNAMEs).
- Choose Custom SSL Certificate for the SSL Certificate. Then, assign the certificate to the distribution. For more information see How do I configure my CloudFront distribution to use an SSL/TLS certificate?
- Then choose “Create Distribution” and wait about 20 minutes for your distribution to deploy.
Also, it is important to remember to update the DNS for your domain to a CNAME record that points to the CloudFront distribution’s provided domain.
If you’re using Amazon Route 53 as your DNS provider, read Configuring Amazon Route 53 to route traffic to CloudFront web distribution. If you’re using another DNS provider, you can create a CNAME record (www.example.com CNAME d111111abcdef8.cloudfront.net) to point to the distribution’s domain.