Search code examples
amazon-web-servicesamazon-cloudfrontamazon-route53

How to redirect to a particular CNAME in a CloudFront Distribution


I have 2 CloudFront distributions in AWS, each with its own different certificate. Each has several CNAMEs attached and each CNAME has a corresponding Record Set in Route 53.

Is there a way to redirect one of the URLs to a CNAME in the other CloudFront Distribution?

So for example, if CloudFront Distribution A contains 2 CNAMES, abc.my-old-site.com and 123.my-old-site.com, and CloudFront Distribution B contains 2 CNAMEs, abc.my-new-site.com and 123.my-new-site.com, can I redirect abc.my-old-site.com to abc.my-new-site.com?


Solution

  • You can do two ways this :

    First

    1. Create S3 bucket
    2. Use this S3 bucket as website hosting
    3. Set website redirect request to abc.my-new-site.com as per screenshot Screenshot1
    4. Set S3 endpoint in route53
    5. If you want to use cloudfront then you can set route53 to cloudfront end point also.

    Second

    1. Domain forwarding in route53 against abc.my-old-site.com to abc.my-new-site.com