Search code examples
amazon-web-servicesamazon-cloudfrontamazon-route53amazon-lightsail

How to apply CDN with cloudfront - router 53 => lightsail instance


i am newbie to AWS and i am struggling set up subdomain access , my materials are :

  • Route 53 : my domain is tranthanhbao.com

  • Lightsail instance : 18.140.2.35 . I already set up nginx reverse proxy and in Route 53 point aws.tranthanhbao.com to 18.140.2.35 with A - ipv4 . It work well MY setting in Route 53 to 18.140.2.35 :
    enter image description here

  • Cloudfront : now i want to apply cloudfront to my domain aws.tranthanhbao.com (http will redirect to https) with below setting enter image description here enter image description here

Then when we access dsor8zoqxftko.cloudfront.net, it works well but i check domain ip , it show :

So my question is how can I apply aws.tranthanhbao.com with cloudfront, not Link: [http://dsor8zoqxftko.cloudfront.net/]


Solution

  • You can try below steps:

    1. Point 18.140.2.35 to some other name like origin.tranthanhbao.com origin.tranthanhbao.com --> 18.140.2.35
    2. Define origin.tranthanhbao.com as an Origin of CloudFront instead of aws.tranthanhbao.com
    3. Modify Route Record for aws.tranthanhbao.com and Choose Alias record (A record) and choose CloudFront distribution.