0

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)

enter image description here

  • 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?

Update

I am using NGINX and the problem is hitting static.ghazanfarmir.me loads the first site within sites-enabled directory i.e. http://arbaeenuk.ghazanfarmir.me/:

enter image description here

  • You need to be more specific than "this doesn't work." What does it do? Why do I see the following DNS lookup result? static.ghazanfarmir.me. 300 IN CNAME ghazanfarmir.me. Why did you create a DNS entry at DigitalOcean DNS, when your domain's DNS is actually hosted by Cloudflare? – Michael - sqlbot Sep 23 '17 at 16:38
0

Amazon CloudFront is designed to work with their Route 53 DNS service using ALIAS resource records.

I'm not sure of the specific details of this and why the requirement. But, if you are going to use an alternate DNS name you need to make sure you configured the Alternate Domain Name for the cloudfront.

Beyond insuring the above is correct, you might need to move your DNS hosting to Route 53. You may be able to just delegate that particular subdomain to Route 53 depending on your DNS provider but that is beyond the scope of the question.

http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-cloudfront-distribution.html

  • I have done the Alternative Domain Name already but luck. Please see screenshots updated in the question – Ghazanfar Mir Sep 23 '17 at 16:09
  • Moving to Route 53 is not necessary unless the hostname is at the apex of a DNS zone. Otherwise, a CNAME is perfectly viable. – Michael - sqlbot Sep 23 '17 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.