[CentOS] EC2 elastic IP failover

Thu Jul 8 22:24:57 UTC 2010
Andrei <frunzales at gmail.com>

Hello,

I have two EC2 instances and I would like to setup some sort of
failover strategy for them.
They currently act as load balancers, forwarding layer 7 traffic using
haproxy and stunnel
to other EC2 instances. One of these load balancers currently has an
elastic IP assigned
with an A record pointing to it. What I'm trying to achieve is to
remap this elastic IP in the
eventuality of an instance failure. I know that
heartbeat/keepalived/pacemaker/openais can
do this without any kind of trouble but these tools don't work in
Amazon's cloud due to
restrictions imposed on their network (multicast/unicast traffic). One
way of doing this would
would require a network monitoring system that supports event-based
script execution. At
this point I'm thinking about writing a wrapper script around
'ec2-associate-address' and upon
detecting a failure on instance A, my network monitoring system would
simply execute the
script on instance B in order to re-associate the elastic IP.

Does anyone have a better/more elegant solution to this?

Regards,

--
Andrei