0
votes

I have a DNS setup with DigitalOcean for the domain

ghazanfarmir.me

What I want to do?

I would like a sub domain i.e. static.ghazanfarmir.me to be linked to the CloudFront Distribution, which then is linked to the S3 bucket containing all my assets. So I can access the CDN using the sub domain static.ghazanfarmir.me.

What I have done so far?

  • Setup S3 bucket containing all of my assets and have created a CloudFront distribution off this S3 bucket (d17jymztihbpvb.cloudfront.net)

Cloudfront CNAME

  • Created CNAME record on DigitalOcean DNS for static.ghazanfarmir.me to the CloudFront distribution i.e. d17jymztihbpvb.cloudfront.net

enter image description here

This doesn't work, can someone please explain how this would work, or if this works at all this way?

2

2 Answers

0
votes

To setup DigitalOcean DNS link to AWS CloudFront Distribution you need to configure two places.

  • Inside the CloudFront distribution, you need to configure "Alternate Domain Names (CNAMEs). enter image description here
  • In DNS configuration, you need to map the CNAME record from CloudFront to your Domain.
0
votes

There are issues with your DNS Setup.

Your DNS has A Record for static.ghazanfarmir.me to a static IP Address. Also the server does a redirect 302 to http://arbaeenuk.ghazanfarmir.me/

A record for 'static.ghazanfarmir.me' need to be removed.

You need to fix the DNS Records and create only CNAME record pointing to d17jymztihbpvb.cloudfront.net.

While keeping the cloudfront distribution as it is. Once the above is performed you need to wait for DNS to clear for the TTL set on the above records to make sure everything is working back again.