I'm running an application on Elastic Beanstalk, an whenever I need to deploy a new version, I need to:
- deploy the version on Elastic Beanstalk, which takes a minute or so
- patch the database with any SQL patches that come with the new version, which takes a few extra seconds
During that time, I'd like the ELB to stop redirecting traffic to the EC2 instances, and only bring back the traffic to them when it's safe to do so (when the software & database versions match).
Is it possible to temporarily redirect the traffic of the ELB somewhere else? Either performing an HTTP redirect to an S3 bucket for example, or reading from this bucket instead of an EC2 instance?
I know I could do this with DNS changes, but these would take extra time to propagate, and even with a low TTL, I still can't guarantee that clients will properly obey the TTL and reach the correct server as soon as I make the update.
So ideally, the DNS should always point to the ELB, and the ELB should then switch the traffic in real time to somewhere else just for the time of the upgrade.