1

I had an experience on cloudflare CDN by setting the nameservers, and I can check by header CF-Cache-Status: HIT to see if it works.

But AWS Cloudfront setting is in different way and I don't sure whether it works or not.

I've read other stackoverflow posts like Cloudfront CNAME vs DNS CNAME, but there have no more details.


Lets's say I want to cdn from domain.com to AWS Cloudfront, and here are what I've done:

  1. Request a certificate to domain.com from Certificate Manager, and add a CNAME record Name:_5d5g45u2j2r5w1s2a8ed2.domain.com/Value:_5f44y54d25s1de4fg4f52s5s4dc1s5.kdiesksqs.acm-validations.aws on domain.com
  2. Certificate Manager success validate domain.com and the certificate was issued abcd-1234-abcd-1234-abcde
  3. Create Distribution from CloudFront with detail:

    • State:Enabled
    • Alternate Domain Names (CNAMEs):domain.com
    • SSL Certificate:domain.com (abcd-1234-abcd-1234-abcde)
    • Domain Name:11ppqrstuv.cloudfront.net

When I browse 11ppqrstuv.cloudfront.net, it looks identically to domain.com, so I know AWS is able to grab my file.

But how could I know the domain.com successfully point to AWS(11ppqrstuv.cloudfront.net)?

Are there anything I need to do?

Autodesk
  • 631
  • 8
  • 27

2 Answers2

0

After searching for many articles, I found my answer, and here is the correct way to set up:

  1. Request a certificate to *.domain.com from Certificate Manager.
  2. Go to domain.com Host Server's DNS setting platform(ex: Godaddy's DNS Management) and add the CNAME record(copy from Certificate Manager).
    Name:_5d5g45u2j2r5w1s2a8ed2.domain.com
    Value:_5f44y54d25s1de4fg4f52s5s4dc1s5.kdiesksqs.acm-validations.aws
  1. Wait for Certificate Manager validate successfully on *.domain.com and generate a certificate abcd-1234-abcd-1234-abcde.
  2. Create Distribution from CloudFront with detail:
    • State: Enabled
    • Alternate Domain Names (CNAMEs): aws.domain.com
    • SSL Certificate: *.domain.com (abcd-1234-abcd-1234-abcde)
    • other settings may find on AWS CloudFront Developer Guide.
  3. Wait for the distribution status show Deployed, and it generate a Domain Name: 11ppqrstuv.cloudfront.net
  4. Back to domain.com Host Server's DNS setting platform(ex: Godaddy's DNS Management) and add the CNAME record.
    Name: aws.domain.com
    Value: 11ppqrstuv.cloudfront.net
  1. To test if it works, go to REDBOT, try http://aws.domain.com/your-folder/file.png, and you will see something like:
    X-Cache: Hit from cloudfront
    Via: 1.1 q2ws5d2w8s2sa3as3s2d5ds2ww.cloudfront.net (CloudFront)
    X-Amz-Cf-Pop: LAX3-C4
    X-Amz-Cf-Id: F1s5s5w5er4f4cls0ekesd4ds5s5sKPoSSCH5e2ss4==
  1. That's it!
Autodesk
  • 631
  • 8
  • 27
0

If you're using a linux machine then you can use dig or host command in the linux for finding the CName record.

dig <your-domain-name>

or

host -t cname <your-domain-name>
Vikram Jakhar
  • 712
  • 1
  • 5
  • 13