I have a real-time application running on an Amazon EC2 instance. I'd like to implement master/slave redundancy with a VPC, a second instance and keepalived. So far it's working reliably, but in the event of a failover, the EIP reassignment is taking about 30 seconds, which doesn't work for my scenario as current connections timeout and get dropped. I'm using a floating internal IP in the VPC and am moving that between the systems, because reassigning the public EIP takes even more time. In a local scenario with VMs, the internal IP address was reassigned and a script running arping was launched to update the router, so the failover took about 1-2s at most. Is there any way to achieve similar speeds with AWS VPC? Thank you!

  • 1
    Are you sure that is related to timeout? TCP connect can't just "failover" without application support. – J-16 SDiZ Aug 5 '15 at 6:56
  • It's a UDP stream. The application is replicated on the 2 instances and uses a shared DB. Whenever I invoke the IP reassignment script ping to the EIP stops for up to 30 seconds and when it comes back up it's pointing to the new server. The failover works fine but I get 30s data loss. – Iskren Aug 5 '15 at 7:27

I believe you can't directly speed up the EIP reassignment because there is no such configuration to take control of the process. (Maybe you can get in touch with the AWS Support Team, to get more info).

However, you can build a more reliable environment using the following options:

  1. Use a AWS ELB, with a low Health Check value. This scenario will route your traffic using two (or more) applications instances (preferably on separated Availability Zones) and will automatically stop send traffic bases on your configuration;
  2. If you are using the AWS OpsWorks for provisioning, create a HAproxy layer configured to use one application instance as a failover, for more information check this link;
  3. Manual setup a load balancer in front of your application to implement the automatic failover.

For all previous scenarios, your main DNS will always point to the load balancer public EIP and you will have full control to configure the environment for a fast failover.

  • you could also explore the route53 failover solution, depending on your use cases. – Tom Jan 12 '16 at 16:47

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.