How to use Cloudfront with s3?

Nazar Kvartalnyi
Written by
COO at Inoxoft, former .Net Software Engineer
Pub: Jul 29, 2021Upd: Feb 05, 2022
Services:

To read about what is CloudFront, see the following answer: What is CloudFront?



Youtube image
Play button

To use CloudFront with s3, you should carry out the following steps:

  1. First, open up your CloudFront console, select “Create Distribution” and click the “Get Started” button, which is under the Web section.
  2. 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.
  3. 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.
  4. 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:

  1. Type your custom domain for Alternate Domain Names (CNAMEs).
  2. 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?
  3. 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.

How to Use Cloudfront with s3?

Looking for Dedicated Team?