Take the 2-minute tour ×

I have a web site hosted in an EC2 instance (2008 r2 + iis7.5 + sql server). I put one linux box running RHEL with varnish. After some configuration trail and error, I found a configuration that works.

Now I want to duplicate the varnish boxes to other availability zones, but continue to pull the pages from the original windows box.

It is my understanding that I can put the varnish boxes in different zones and pull from the windows box via it's external IP. But what do I need to do in order for each user to receive content from the box physically closest to them? Is this even possible?

Thank you!

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Why would you not use Amazon's CloudFront for this? You're already trusting Amazon, and they support cusotm origins and caching dynamic objects.

Don't build your own CDN, there's no way you can do it cheaper or better than the CDNs already out there.

share|improve this answer
Ok. This is what I was thinking. Can I put CloudFront infront of the varnish (or maybe even the iis box)? And if so, can you point me to a resource? –  Elad Lachmi Jun 12 '12 at 17:54
You can put CloudFront directly in front of the IIS box. CloudFront does caching, so no need for varnish really unless I am missing some piece of your use case. Documentation is available at aws.typepad.com/aws/2010/11/…. Using IIS is no different than any other "custom origin" as far as CloudFront is concerned. Ensure you have appropriate "Cache-Control" headers being set at the IIS layer for static files, or in your code for dynamic pages. –  rmalayter Jun 14 '12 at 17:07
add comment

You would need to use a DNS provider that provides a geo-locational lookup services. They pretty much do this

  • user enters host
  • request hits their dns servers
  • they lookup the users IP address against a ip->geo database to get the users rough area of the world
  • They return the IP address of the EC2 instance that is closer to them based on the IPs you enter for that host

The company I have worked for used http://dyn.com/dns/ They are pricey for their geo-dns service. I think it's only included in their $200 a month plan.


If you want to roll your own dns service to do this, here is a post with some good info


share|improve this answer
Thank you for the reply. I was actually looking for maybe something build in to AWS for this. I was thinking that since they operate a CDN, maybe they also have this functionality built in to the load balancer or something. –  Elad Lachmi Jun 12 '12 at 15:33
amazon's dns offering is called route53 which doesn't support geo lookups yet. –  Mike Jun 12 '12 at 15:41
add comment

Your Answer


