Skip to content

Instantly share code, notes, and snippets.

@robbwagoner
Created October 30, 2014 19:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robbwagoner/9e831a9d55aa5df41e08 to your computer and use it in GitHub Desktop.
Save robbwagoner/9e831a9d55aa5df41e08 to your computer and use it in GitHub Desktop.

Production Blue-Green Deployment Pattern

came up during IRIS call with Zac, Joel, Julian & Robb - This is Robb's write-up on the matter.

  1. Blue-Green deployment: two Production ASGs & ELBs
  • only one is live at any time (Route53 Alias)
  • standby ASG can be deployed-to (rollforward or rollback), warmed-up (scaling, caching ,etc), and verified (smoke tests, etc. aginst standby.us-east-1.iris.tv) BEFORE being made live
  • Route53 API ChangeResourceRecordSets are transactional
  • Post-swap, the newly standby ASG can be updated to 0 desired instances (min and max = 0 too).
  • DNS changing is how AWS Elastic Beanstalk works too (SWAP CNAME API call).
  • Route53 Alias queries are free
  • This opens up possibilities for Route53 Latency-based routing (i.e. hosting from multiple AWS Regions)
  • See also this write-up from thoughtworks.com on the various techniques for blue-green deployment with AWS, ELB, EIP, ASGs, Route53, etc.

                                              +--------------------+
                                              |        DNS         |
                                              |                    |
                                              | CNAMEs (TTL 300):  |
                                              |  api.iris.tv       |
                                              |  api-lat.iris.tv   |
                                              |  api*.iris.tv      |
                                              |                    |
                                              +---------+----------+
                                                        |
                                                        |
                                                        |
                                             live.us-east-1.iris.tv
                                                        |
                                                        |
                                                        v
                                           +----------------------------+
                                           |         Route53            |
                                           |                            |
                                           | Route53 Alias RR           |
                                           |  live.us-east-1.iris.tv    |
                                           |  standby.us-east-1.iris.tv |
                                           |                            |
                                           +------+--------------+------+
                                                  |              |
                                                  |              |
                                                  |              |
                                                  |              |
                                                  |              |
                                                  |              |
                                                  |              |
                      +-------standby Alias-------+              +---live Alias----+
                      |             ^                                   ^          |
                      |             |                                   |          |
                      |             |         +-----------------+       |          |
                      |             +---------+ SWAP TO GO LIVE +-------+          |
                      |                       |  (Route53 API)  |                  |
                      v                       +-----------------+                  v
+-------------------------------------------------------+    +-------------------------------------------------------+
|                      ELB                              |    |                      ELB                              |
| production-blue-746907157.us-east-1.elb.amazonaws.com |    | production-green-23882388.us-east-1.elb.amazonaws.com |
|                                                       |    |                                                       |
+-----------------------+-------------------------------+    +-----------------------+-------------------------------+
                      |                                                            |
                      |                                                            |
                      |                                                            |
                      |                                                            |
            +---------+--------+                                          +--------+---------+
            |       ASG        |                                          |       ASG        |
            | production-blue  |                                          | production-green |
            |                  |                                          |                  |
            +------------------+                                          +------------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment