how to map single Route53 domain to multiple CloudFront domain names?

0

I have multiple cloudfront endpoints configured for origin in residing in different regions. Is it possible to route the traffic to multiple cloudfront distribution using single domain name?

2 Answers
0

Can you elaborate your use case? Amazon CloudFront uses a global network of edge locations and regional edge caches, when you create a CF distribution you don't choose a Region, so how could you have them per Region?

  1. Assuming what you would like to achieve is routing traffic to different origins that are in different Regions, you can set your CF distribution using a single domain name, then you can have multiple origins attached to your CF distribution and configure the behaviour to route to the appropriate resource, and in the Route 53 you will add just one record with a single domain name, here an example: https://aws.amazon.com/premiumsupport/knowledge-center/cloudfront-distribution-serve-content/
  2. Another option without CF but for routing to different Regions can be: configure Route 53 with Geoproximity and specify the AWS Region where the resources are hosted: https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-policy-geoproximity.html For a more accurate answer please share more details of what you are trying to achieve, if this answer helps you please accept the answer.
profile pictureAWS
answered a year ago
  • Hello,

    I mean to say a separate cloudfront distribution has been created for each origin which are residing in different regions. Is it possible to redirect the traffic to these origins using a single Route 53 domain?

0

Which is your routing decision, and do you want to use customised domain name in CloudFront or not?

  1. For instance, if your routing decision for route to a specific distribution is based on user location, so you can have in r53 something like:

     example.com = my distribution1.cloudfront.net, And a geolocation routing policy, if my user is from this "country" route to this record
     example.com = mydistribution2.cloudfront.net, same
     example.com = mydistribution3.cloudfront.net, same
    
  2. Otherwise the answer is no. You must create a record in Route 53 to route dns queries to cloudfront. When Route 53 receives a DNS query that matches the name and type of a record, Route 53 responds with the domain name that is associated with your distribution. So, if you use a customised domain name in CF all the distributions will have the same domain name and then how to know which one is the correct? Also, depends on your routing decision, r53 supports certain routing policies, if it is not based on user location or AWS Resources, then also it is not possible to use the same domain name.

But also you will have 3 distributions, you can optimise the design. For example for this case the routing can be done in CloudFront and not in R53. You do not need different distributions with the same domain name for multiple origins. You can use just one cloud front distribution with multiple origins, and these origins can be in different Regions, this is the most straightforward approach. Then, in the cloud front distribution you configure the behaviour (this is like the "routing" mechanism) and route your request to the specific origin. Here some references:

https://aws.amazon.com/premiumsupport/knowledge-center/cloudfront-distribution-serve-content/ https://catalog.us-east-1.prod.workshops.aws/workshops/4557215e-2a5c-4522-a69b-8d058aba088c/en-US/basic-configuration/create-multiple-origins https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesPathPattern

profile pictureAWS
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions