1

I have 1 instance each in 2 regions (US West and EU London) in Amazon EC2. I would like to achieve following:

  1. Distribute traffic based on regions:

    For example: if the request originates from US then use US Region and if the request originates from UK then use EU Region

  2. Backup:

    In case of failure, the requests are directed to the working instance

I have tried to search for such scenarios but I only found one or the other but nothing that provides solution for both the scenarios.

Classic Load Balancing:

- If US instance fails, the requests are automatically directed to EU instance.
- But, when both the instances are running, the requests will be balanced and divided (irrespective of where the request originated from)

Application Load Balancing:

- I could set different URLs for US and EU and use application load balancing to direct requests to the instance of the respective region.
- But if US instance fails, the requests won't be directed to EU instance.

Amazon Route 53:

3

Use Route 53 latency based routing with health checks enabled. It addresses both of your aims:

  • It sends requests to the faster server for the client
  • If one server stops responding all requests are sent to the other server

If you only have one instance per region you don't need any kind of load balancer.

As Michael points out, you should consider using CloudFront. I won't copy his comment, but his method has advantages over the basic method I outlined above.

  • 3
    Augment this by doing it all behind CloudFront, so that traffic on the back side of CloudFront is routed to the back-end instance nearest to the CloudFront edge, using Route 53 latency-based routing. (On the front side, browsers automatically connect to a nearby edge.) This avoids DNS TTL issues (CloudFront honors origin server DNS TTLs, browsers don't) and brings your traffic onto the managed AWS network as close to the viewer as possible. – Michael - sqlbot Aug 16 '17 at 5:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.