red888
red888

Reputation: 31540

Can I use cloudfront with a route53 traffic policy?

I have 12 instances of my app in 12 diff regions fronted by elbs

I use a geo based route53 traffic policy to route to diff regions

Can I point a cloudfront distribution to that policy record as it's origin and will it just work? Any caveats to using cloudfront and route53 this way?

Upvotes: 0

Views: 670

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269191

Putting multiple Amazon EC2 instances in 12 Regions is quite an investment! Presumably you are doing this to reduce latency for your users.

Amazon CloudFront has points-of-presence in over 200 locations, so it is recommended for serving static content. This typical means content that does not change between users, such as pictures, style sheets and script files. It allows you to offload a lot of this traffic from your web servers, meaning that you could probably run fewer web servers.

Amazon Route 53 geo-routing is used to send traffic from specific countries to particular destinations (eg all requests from Germany are sent to a server with content in German). However, given that you have distributed your traffic to multiple regions, it might be better for you to use Latency-based routing since this will direct traffic to a location that will provide the lowest latency for your users.

Combining Route 53 and CloudFront might provide some advantages, depending upon how they are configured.

Firstly, you published DNS Name will need to resolve to CloudFront so that it can serve content from all points of presence. This is ideal for static content.

Next comes the question of how to configure the origin for content required by CloudFront. This could be another DNS name that is configured in Route 53 for latency-based routing, which means that CloudFront will pull the content from a 'nearby' location rather than going back to a single origin. This will not matter much for cached content, but it could speed the delivery of dynamic content (that is, content that is different for each user).

I would recommend that you perform tests for each of these options and determine which ones meet your performance goals, but also taking into account the expense for each option. For example:

  • Option 1: Amazon CloudFront and ONE origin - This would be lowest cost, but might be too slow for dynamic content
  • Option 2: No CloudFront, but multiple regions (as you are currently using) - This would be a considerably higher cost, but could serve the quickly traffic if using Latency-based Routing
  • Option 3: CloudFront + Multiple regions - Be careful how this is configured (it needs multiple levels of DNS) but this could be even faster than Option #2

You should test each option and compare the results against your specific speed/latency goals. Then you should compare the cost of each option to see whether it is providing the desired cost/benefit ratio.

Upvotes: 2

Related Questions