This is exact problem we (Cedexis) solve.
Assume your site is www.website.com, in general points to an A record or a CNAME to a datacenter/ cloud/ CDN.
We add an intermediate hostname, low TTL (20 seconds), global anycast network, which can be scripted (write your load-balancing logic in php) to handout a CNAME (one of many) based on performance (RTT), load, cost, anything else you can think of, etc.
Re.: AWS's recent outage, assuming you are running your apps in multiple zones/ regions/ clouds, we would have noticed the latency and automatically routed away to a different zone/ region/ cloud.
We collect hundreds of millions of performance measurements daily: http://gigaom.com/cloud/heres-what-amazon-outage-looked-like...
Drop an email and I am happy to explain more and setup folks from HN with a free account: prakash at cedexis.com