Services for blue/green deployments - Blue/Green Deployments on AWS

This whitepaper is for historical reference only. Some content might be outdated and some links might not be available.

Services for blue/green deployments

AWS provides a number of tools and services to help you automate and streamline your deployments and infrastructure.You can access these tools using the web console, CLI tools, SDKs, and IDEs..

Amazon Route 53

Amazon Route 53 is a highly available and scalable authoritative DNS service that routes user requests for Internet-based resources to the appropriate destination. Amazon Route 53 runs on a global network of DNS servers providing customers with added features, such as routing based on health checks, geography, and latency. DNS is a classic approach to blue/green deployments, allowing administrators to direct traffic by simply updating DNS records in the hosted zone. Also, time to live (TTL) can be adjusted for resource records; this is important for an effective DNS pattern because a shorter TTL allows record changes to propagate faster to clients.

Elastic Load Balancing

Another common approach to routing traffic for a blue/green deployment is through the use of load balancing technologies. Amazon Elastic Load Balancing distributes incoming application traffic across designated Amazon Elastic Compute Cloud (Amazon EC2) instances. Elastic Load Balancing scales in response to incoming requests, performs health checking against Amazon EC2 resources, and naturally integrates with other services, such as Auto Scaling. This makes it a great option for customers who want to increase application fault tolerance.

Auto Scaling

Amazon EC2 Auto Scaling helps maintain application availability and lets you scale EC2 capacity up or down automatically according to defined conditions. The templates used to launch EC2 instances in an Auto Scaling group are called launch configurations. You can attach different versions of launch configurations to an auto scaling group to enable blue/green deployment. You can also configure auto scaling for use with an ELB. In this configuration, the ELB balances the traffic across the EC2 instances running in an auto scaling group. You define termination policies in auto scaling groups to determine which EC2 instances to remove during a scaling action; auto scaling also allows instances to be placed in Standby state, instead of termination, which helps with quick rollback when required. Both auto scaling's termination policies and Standby state allow for blue/green deployment.

AWS Elastic Beanstalk

AWS Elastic Beanstalk is a fast and simple way to get an application up and running on AWS. It’s perfect for developers who want to deploy code without worrying about managing the underlying infrastructure. Elastic Beanstalk supports Auto Scaling and Elastic Load Balancing, both of which allow for blue/green deployment. Elastic Beanstalk helps you run multiple versions of your application and provides capabilities to swap the environment URLs, facilitating blue/green deployment.

AWS OpsWorks

AWS OpsWorks is a configuration management service based on Chef that allows customers to deploy and manage application stacks on AWS. Customers can specify resource and application configuration, and deploy and monitor running resources. OpsWorks simplifies cloning entire stacks when you’re preparing blue/green environments.

AWS CloudFormation

AWS CloudFormation provides customers with the ability to describe the AWS resources they need through JSON or YAML formatted templates. This service provides very powerful automation capabilities for provisioning blue/green environments and facilitating updates to switch traffic, whether through Route 53 DNS, ELB, or similar tools. The service can be used as part of a larger infrastructure as code strategy, where the infrastructure is provisioned and managed using code and software development techniques, such as version control and continuous integration, in a manner similar to how application code is treated.

Amazon CloudWatch

Amazon CloudWatch is a monitoring service for AWS resources and applications. CloudWatch collects and visualizes metrics, ingests and monitors log files, and defines alarms. It provides system-wide visibility into resource utilization, application performance, and operational health, which are key to early detection of application health in blue/green deployments.

AWS CodeDeploy

AWS CodeDeploy is a deployment service that automates deployments to various compute types such as EC2 instances, on-premises instances, Lambda functions, or Amazon ECS services. Blue/Green deployment is a feature of CodeDeploy. CodeDeploy can also roll back deployment in case of failure. You can also use CloudWatch alarms to monitor the state of deployment and utilize CloudWatch Events to process the deployment or instance state change events.

Amazon Elastic Container Service

There are three ways traffic can be shifted during a deployment on Amazon Elastic Container Service (Amazon ECS):

  • Canary – Traffic is shifted in two increments.

  • Linear – Traffic is shifted in equal increments.

  • All-at-once – All traffic is shifted to the updated tasks.

AWS Lambda Hooks

With AWS Lambda hooks, CodeDeploy can call the Lambda function during the various lifecycle events including deployment of ECS, Lambda function deployment, and ECC2/On-premise deployment. The hooks are helpful in creating a deployment workflow for your apps.