AWS CodeDeploy
User Guide (API Version 2014-10-06)

The procedures in this guide support the new console design. If you choose to use the older version of the console, you will find many of the concepts and basic procedures in this guide still apply. To access help in the new console, choose the information icon.

Create an Application for a Blue/Green Deployment (Console)

To use the AWS CodeDeploy console to create an application for a blue/green deployment:

Note

A deployment to the AWS Lambda compute platform is always a blue/green deployment. You do not specify a deployment type option.

Warning

Do not follow these steps if:

  1. Sign in to the AWS Management Console and open the AWS CodeDeploy console at https://console.aws.amazon.com/codedeploy.

    Note

    Sign in with the same account or IAM user information that you used in Getting Started with AWS CodeDeploy.

  2. In the navigation pane, expand Deploy, and then choose Getting started.

  3. In Application name, enter the name of your application .

  4. From Compute platform, choose EC2/On-Premises.

  5. Choose Create application.

  6. On your application page, from the Deployment groups tab, choose Create deployment group.

  7. In Deployment group name, enter a name that describes the deployment group.

    Note

    If you want to use the same settings used in another deployment group (including the deployment group name tags, Amazon EC2 Auto Scaling group names, and the deployment configuration), choose those settings on this page. Although this new deployment group and the existing deployment group have the same name, AWS CodeDeploy treats them as separate deployment groups, because each is associated with a separate application.

  8. In Service role, choose a service role that grants AWS CodeDeploy access to your target instance.

  9. In Deployment type choose Blue/green.

  10. In Environment configuration, choose the method to use to provide instances for your replacement environment:

    1. Automatically copy Amazon EC2 Auto Scaling group: AWS CodeDeploy creates an Amazon EC2 Auto Scaling group by copying one you specify.

    2. Manually provision instances: You won't specify the instances for your replacement environment until you create a deployment. You must create the instances before you start the deployment. Instead, here you specify the instances you want to replace.

  11. Depending on your choice in step 10, do one of the following:

    • If you chose Automatically copy Amazon EC2 Auto Scaling group: In Amazon EC2 Auto Scaling group, choose or enter the name of the Amazon EC2 Auto Scaling group you want to use as a template for the Amazon EC2 Auto Scaling group for the instances in your replacement environment. The number of currently healthy instances in the Amazon EC2 Auto Scaling group you choose is created in your replacement environment.

    • If you chose Manually provision instances: Enable Amazon EC2 Auto Scaling groups, Amazon EC2 intances, or both to specify instances to add to this deployment group. Enter Amazon EC2 tag values or Amazon EC2 Auto Scaling group names to identify the instances in your original environment (that is, the instances you want to replace or that are running the current application revision).

  12. (Optional) In Load balancer, enable Enable load balancing, and then choose an existing Classic Load Balancer, Application Load Balancer, or Network Load Balancer to manage traffic to the instances during the deployment processes.

    Each instance is deregistered from the load balancer (Classic Load Balancers) or target group (Application Load Balancers and Network Load Balancers) to prevent traffic from being routed to it during the deployment. It is re-registered when the deployment is complete.

    For more information about load balancers for AWS CodeDeploy deployments, see Integrating AWS CodeDeploy with Elastic Load Balancing.

  13. In Deployment settings, review the default options for rerouting traffic to the replacement environment, which deployment configuration to use for the deployment, and how instances in the original environment are handled after the deployment.

    If you want to change the settings, continue to the next step. Otherwise, skip to step 15.

  14. To change the deployment settings for the blue/green deployment, change any of the following settings.

    Setting Options
    Traffic rerouting
    • Reroute traffic immediately: As soon as instances in the replacement environment are provisioned and the latest application revision is installed on them, they are registered with the load balancer automatically, causing traffic to be rerouted to them. Instances in the original environment are then deregistered.

    • I will choose whether to reroute traffic: Instances in the replacement environment are not registered with the load balancer unless you manually reroute traffic. If the wait time you specify passes without traffic being rerouted, the deployment status is changed to Stopped.

    Deployment configuration

    Choose the rate at which instances in the replacement environment are registered with the load balancer, such as one at a time or all at once.

    Note

    After traffic is successfully routed to the replacement environment, instances in the original environment are deregistered all at once no matter which deployment configuration was selected.

    For more information, see Working with Deployment Configurations in AWS CodeDeploy.

    Original instances
    • Terminate the original instances in the deployment group: After traffic is rerouted to the replacement environment, the instances that were deregistered from the load balancer are terminated following the wait period you specify.

    • Keep the original instances in the deployment group running: After traffic is rerouted to the replacement environment, the instances that were deregistered from the load balancer are kept running.

  15. (Optional) In Advanced, configure options you want to include in the deployment, such as Amazon SNS notification triggers, Amazon CloudWatch alarms, or automatic rollbacks.

    For information about specifying advanced options in deployment groups, see Configure Advanced Options for a Deployment Group.

  16. Choose Create deployment group.

The next step is to prepare a revision to deploy to the application and deployment group. For instructions, see Working with Application Revisions for AWS CodeDeploy.