Skip to content

How to use Amazon CDN or Cloudfront

Domain registration

  • To do this, first point an A record to your server address in DNS. Suppose you have pointed to the IP address of your server.

  • Go to Amazon AWS and search for Cloudfront service.

  • Create a destination by clicking create distribution.
  • Enter the values in the opened page according to the image below.

aws settings

All values on this page are default except for the following which should be set as shown in the images.

protocols policy

cache policy

waf settings

  • At the end, click on create distribution to perform the creation operation.
  • In the next step, go to the location of your DNS records. Assuming that you have registered in Cloudflare, enter the DNS section of your domain and create a cname record. Suppose you create and set its value equal to the domain created in the previous step in AWS. This value can be seen in the details section under Distribution domain name.

In fact, this subdomain will be used for our CDN domain.

  • Go back to the AWS panel and click on the edit option in the General tab of the setting section and click on Add item in the Alternate domain name (CNAME) - optional section that opens. and enter the cname domain from the previous step,

Getting a certificate

  • Enter the Custom SSL certificate - optional section and get an ssl certificate for the desired domain. For this, click on Request certificate.
  • In the newly opened page, continue the process of receiving the certificate and in the domain name section and the address field, enter the details of the subdomain registered in the previous step, namely and set the other values as default. and click on Request.

  • On the certificate list page, you can see that the desired domain status is pending validation. Click on the ID and see the Domains section on the opened page.

domain settings

  • In this section, two values of this section, Cname name and Cname value are needed to complete the certificate status.
  • Go to your DNS records (presumably Cloudflare) and create a Cname name record and enter the values you had in the previous step in AWS. In Cloudflare, enter Cname name instead of name and Cname value instead of Target.
  • Now if you go back to AWS and the certificate list page and refresh the page, you will see that the status has changed from pending to issues, which means that our domain has received the certificate correctly.
  • Now it is back to the distribution settings page and the certificate derivation stage, and if you click the refresh button for custom ssl, you can see the certificate you received in the previous stage. Select it and leave the other values of this page as default.

[!tip] Note: Be careful not to tick the Legacy client support because this option costs $600 per month.

  • At the end, click the save changes option to save the changes.
  • Now wait until the changes are applied and according to the image below, the state of Last modified will change from Depoloying to done to the date and time.

done page

  • It usually takes between 2-5 minutes for these changes to be applied, which can be followed by refreshing the screen. Always remember that at any stage you make changes, it should change to this state, which means that the changes are fully applied and usable.

  • Congratulations, the work is done. Amazon Cloudfront CDN is successfully launched. Now just register your CDN domain in your HiFi Manager.

Last update: June 29, 2024