0

I am running two instances one in Singapore and one in Oregon. How do I make my app to connect the nearest running instance based on the region?

And is there a way if I can provide only one IP which will target to both the instances and choose according to the latency.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
user1169079
  • 3,053
  • 5
  • 42
  • 71

1 Answers1

1

Use Route 53 Latency-Based Routing:

  • Create a Hosted Zone for your domain name in Route 53
  • Create Record Set of type CNAME, a value of the DNS Name or IP address of one of your instances, and a Routing Policy of Latency. Select the Region where that instance is located.
  • Repeat for the second instance.

That's it! The domain name will then automatically redirect to the instance with the lowest latency connection.

It is advisable to use Elastic IP Addresses in case the instances are ever stopped (which could cause the IP address to change).

It is not possible to "provide only one IP which will target to both the instances" -- instead, you need to use the domain name, which will resolve to one of the IP addresses of your two instances.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
  • Great answer point to point. Thanks this saved my time a lot .. one more question Is it necessary to use ELB for Route 53 or its ok just to use Route 53 ? – user1169079 Apr 11 '16 at 10:48
  • ELB is a regional service, part of EC2, used to load balance traffic across multiple EC2 instances in the same region. It can also be used with just one instance in a region, if you want to use it to terminate SSL so your instance doesn't have to. If you have only one instance per region and you don't need the SSL capability of ELB, then it is not needed in this application. – Michael - sqlbot Apr 11 '16 at 14:09