

# Working with deployment configurations in CodeDeploy
<a name="deployment-configurations"></a>

A deployment configuration is a set of rules and success and failure conditions used by CodeDeploy during a deployment. These rules and conditions are different, depending on whether you deploy to an EC2/On-Premises compute platform, AWS Lambda compute platform, or Amazon ECS compute platform. 

## Deployment configurations on an EC2/on-premises compute platform
<a name="deployment-configuration-server"></a>



When you deploy to an EC2/On-Premises compute platform, the deployment configuration specifies, through the use of a 'minimum healthy hosts' value and an optional 'minimum healthy hosts per zone' value, the number or percentage of instances that must remain available at any time during a deployment.

You can use one of the three predefined deployment configurations provided by AWS or create a custom deployment configuration. For more information about creating custom deployment configurations, see [Create a deployment configuration with CodeDeploy](deployment-configurations-create.md). If you don't specify a deployment configuration, CodeDeploy uses the CodeDeployDefault.OneAtATime deployment configuration.

For more information about how CodeDeploy monitors and evaluates instance health during a deployment, see [CodeDeploy instance health](instances-health.md). To view a list of deployment configurations already registered to your AWS account, see [View deployment configuration details with CodeDeploy](deployment-configurations-view-details.md). 

### Predefined deployment configurations for an EC2/on-premises compute platform
<a name="deployment-configurations-predefined"></a>

The following table lists the predefined deployment configurations.

**Note**  
There are no predefined deployment configurations that support the [zonal configuration](deployment-configurations-create.md#zonal-config) feature (which is the feature that lets you specify the number of healthy hosts per Availability Zone). If you want to use this feature, you must [create your own deployment configuration](deployment-configurations-create.md).


****  

| Deployment configuration | Description | 
| --- | --- | 
| CodeDeployDefault.AllAtOnce | **In-place deployments**:Attempts to deploy an application revision to as many instances as possible at once. The status of the overall deployment is displayed as Succeeded if the application revision is deployed to one or more of the instances. The status of the overall deployment is displayed as Failed if the application revision is not deployed to any of the instances. Using an example of nine instances, CodeDeployDefault.AllAtOnce attempts to deploy to all nine instances at once. The overall deployment succeeds if deployment to even a single instance is successful. It fails only if deployments to all nine instances fail. **Blue/green deployments**: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-configurations.html) | 
| CodeDeployDefault.HalfAtATime |  **In-place deployments**: Deploys to up to half of the instances at a time (with fractions rounded down). The overall deployment succeeds if the application revision is deployed to at least half of the instances (with fractions rounded up). Otherwise, the deployment fails. In the example of nine instances, it deploys to up to four instances at a time. The overall deployment succeeds if deployment to five or more instances succeed. Otherwise, the deployment fails.   If you're deploying to instances in multiple Auto Scaling groups, CodeDeploy will deploy to up to half of the instances at a time *regardless of the Auto Scaling group they're in*. For example, let's assume you have two Auto Scaling groups, `ASG1` and `ASG2`, each with 10 instances. In this scenario, CodeDeploy might deploy to 10 instances in just `ASG1` and consider this a success because it has deployed to at least half of the instances.  **Blue/green deployments**:  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-configurations.html)  | 
| CodeDeployDefault.OneAtATime |  **In-place deployments**: Deploys the application revision to only one instance at a time. For deployment groups that contain more than one instance: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-configurations.html) For deployment groups that contain only one instance, the overall deployment is successful only if deployment to the single instance is successful. **Blue/green deployments**: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-configurations.html)  | 

## Deployment configurations on an Amazon ECS compute platform
<a name="deployment-configuration-ecs"></a>

When you deploy to an Amazon ECS compute platform, the deployment configuration specifies how traffic is shifted to the updated Amazon ECS task set. You can shift traffic using a **canary**, **linear**, or **all-at-once** deployment configuration. For more information, see [Deployment configuration](primary-components.md#primary-components-deployment-configuration).

You can also create your own custom canary or linear deployment configuration. For more information, see [Create a deployment configuration with CodeDeploy](deployment-configurations-create.md).

### Predefined deployment configurations for an Amazon ECS compute platform
<a name="deployment-configurations-predefined-ecs"></a>

The following table lists the predefined configurations available for Amazon ECS deployments.

**Note**  
If you're using a Network Load Balancer, only the `CodeDeployDefault.ECSAllAtOnce` predefined deployment configuration is supported.


****  

| Deployment configuration | Description | 
| --- | --- | 
|  CodeDeployDefault.ECSLinear10PercentEvery1Minutes  |  Shifts 10 percent of traffic every minute until all traffic is shifted.  | 
|  CodeDeployDefault.ECSLinear10PercentEvery3Minutes   |  Shifts 10 percent of traffic every three minutes until all traffic is shifted.  | 
|  CodeDeployDefault.ECSCanary10Percent5Minutes  |  Shifts 10 percent of traffic in the first increment. The remaining 90 percent is deployed five minutes later.  | 
| CodeDeployDefault.ECSCanary10Percent15Minutes |  Shifts 10 percent of traffic in the first increment. The remaining 90 percent is deployed 15 minutes later.  | 
|  CodeDeployDefault.ECSAllAtOnce  |  Shifts all traffic to the updated Amazon ECS container at once.  | 

## Deployment configurations for CloudFormation blue/green deployments (Amazon ECS)
<a name="deployment-configuration-cfn-bg"></a>

 When you deploy to an Amazon ECS compute platform through CloudFormation blue/green deployments, the deployment configuration specifies how traffic is shifted to the updated Amazon ECS container. You can shift traffic using a **canary**, **linear**, or **all-at-once** deployment configuration. For more information, see [Deployment configuration](primary-components.md#primary-components-deployment-configuration).

With CloudFormation blue/green deployments, you cannot create your own custom canary or linear deployment configuration. For step-by-step instructions on using CloudFormation to manage your Amazon ECS blue/green deployments, see [Automate ECS blue/green deployments through CodeDeploy using CloudFormation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/blue-green.html) in the *CloudFormation User Guide*. 

**Note**  
Managing Amazon ECS blue/green deployments with CloudFormation is not available in the Europe (Milan), Africa (Cape Town), and Asia Pacific (Osaka) regions.

## Deployment configurations on an AWS Lambda compute platform
<a name="deployment-configuration-lambda"></a>

When you deploy to an AWS Lambda compute platform, the deployment configuration specifies the way traffic is shifted to the new Lambda function versions in your application. You can shift traffic using a **canary**, **linear**, or **all-at-once** deployment configuration. For more information, see [Deployment configuration](primary-components.md#primary-components-deployment-configuration).

You can also create your own custom canary or linear deployment configuration. For more information, see [Create a deployment configuration with CodeDeploy](deployment-configurations-create.md).

### Predefined deployment configurations for an AWS Lambda compute platform
<a name="deployment-configurations-predefined-lambda"></a>

The following table lists the predefined configurations available for AWS Lambda deployments.


****  

| Deployment configuration | Description | 
| --- | --- | 
|  CodeDeployDefault.LambdaCanary10Percent5Minutes  |  Shifts 10 percent of traffic in the first increment. The remaining 90 percent is deployed five minutes later.  | 
|  CodeDeployDefault.LambdaCanary10Percent10Minutes  |  Shifts 10 percent of traffic in the first increment. The remaining 90 percent is deployed 10 minutes later.  | 
|  CodeDeployDefault.LambdaCanary10Percent15Minutes  |  Shifts 10 percent of traffic in the first increment. The remaining 90 percent is deployed 15 minutes later.  | 
|  CodeDeployDefault.LambdaCanary10Percent30Minutes  |  Shifts 10 percent of traffic in the first increment. The remaining 90 percent is deployed 30 minutes later.  | 
|  CodeDeployDefault.LambdaLinear10PercentEvery1Minute  | Shifts 10 percent of traffic every minute until all traffic is shifted. | 
|  CodeDeployDefault.LambdaLinear10PercentEvery2Minutes  |  Shifts 10 percent of traffic every two minutes until all traffic is shifted.  | 
|  CodeDeployDefault.LambdaLinear10PercentEvery3Minutes  |  Shifts 10 percent of traffic every three minutes until all traffic is shifted.  | 
| CodeDeployDefault.LambdaLinear10PercentEvery10Minutes | Shifts 10 percent of traffic every 10 minutes until all traffic is shifted. | 
|  CodeDeployDefault.LambdaAllAtOnce  |  Shifts all traffic to the updated Lambda functions at once.  | 

## Topics
<a name="topiclist-deployment-configurations"></a>
+ [Create a Deployment Configuration](deployment-configurations-create.md)
+ [View Deployment Configuration Details](deployment-configurations-view-details.md)
+ [Delete a Deployment Configuration](deployment-configurations-delete.md)

# Create a deployment configuration with CodeDeploy
<a name="deployment-configurations-create"></a>

If you don't want to use one of the default deployment configurations provided with CodeDeploy, you can create your own using the following instructions.

You can use the CodeDeploy console, AWS CLI, the CodeDeploy APIs, or an CloudFormation template to create custom deployment configurations. 

For information about using an CloudFormation template to create a deployment configuration, see [CloudFormation templates for CodeDeploy reference](reference-cloudformation-templates.md).

**Topics**
+ [

## Creating a deployment configuration (console)
](#deployment-configurations-create-console)
+ [

## Creating a deployment configuration with CodeDeploy (AWS CLI)
](#deployment-configurations-create-cli)

## Creating a deployment configuration (console)
<a name="deployment-configurations-create-console"></a>

Use the following instructions to create a deployment configuration using the AWS console.

**To create a deployment configuration in CodeDeploy using the console**

1. Sign in to the AWS Management Console and open the CodeDeploy console at [https://console.aws.amazon.com/codedeploy](https://console.aws.amazon.com/codedeploy).
**Note**  
Sign in with the same user that you set up in [Getting started with CodeDeploy](getting-started-codedeploy.md).

1. In the navigation pane, choose **Deployment configurations**.

   A list of built-in deployment configurations appears.

1. Choose **Create deployment configuration**.

1. In **Deployment configuration name**, enter a name for the deployment configuration. For example, **my-deployment-config**.

1. Under **Compute platform**, choose one of the following:
   + **EC2/On-premises**
   + **AWS Lambda**
   + **Amazon ECS**

1. Do one of the following:
   + If you chose **EC2/On-premises**:

     1. Under **Minimum healthy hosts**, specify the number or percentage of instances that must remain available at any time during a deployment. For more information about how CodeDeploy monitors and evaluates instance health during a deployment, see [CodeDeploy instance health](instances-health.md).

     1. (Optional) Under **Zonal configuration**, select **Enable zonal configuration** to have CodeDeploy deploy your application to one [Availability Zone](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#concepts-availability-zones) at a time, within an AWS Region. By deploying to one Availability Zone at a time, you can expose your deployment to a progressively larger audience as confidence in the deployment's performance and viability grows. If you don't enable a zonal configuration, CodeDeploy deploys your application to a random selection of hosts across a Region.

        If you enable the zonal configuration feature, note the following:
        + The zonal configuration feature is only supported with in-place deployments to Amazon EC2 instances. (Blue/green deployments and on-premises instances are not supported.) For more information about in-place deployments, see [Deployment type](primary-components.md#primary-components-deployment-type).
        + The zonal configuration feature is not supported with [predefined deployment configurations](deployment-configurations.md#deployment-configurations-predefined). To use a zonal configuration, you must create a custom deployment configuration, as described here.
        + If CodeDeploy needs to roll back a deployment, CodeDeploy will perform the rollback operations on random hosts. (CodeDeploy will not roll back one zone at a time, as you might expect.) This rollback behavior was chosen for performance reasons. For more information about rollbacks, see [Redeploy and roll back a deployment with CodeDeploy](deployments-rollback-and-redeploy.md).

     1. If you selected the **Enable zonal configuration** check box, optionally specify the following options:
        + (Optional) In **Monitor duration**, specify the period of time, in seconds, that CodeDeploy must wait after completing a deployment to an Availability Zone. CodeDeploy will wait this amount of time before starting a deployment to the next Availability Zone. Consider adding a monitor duration to give the deployment some time to prove itself (or 'bake') in one Availability Zone before it is released in the next zone. If you don't specify a monitor duration, then CodeDeploy starts deploying to the next Availability Zone immediately. For more information about how the **Monitor duration** setting works, see [About the minimum number of healthy instances per Availability Zone](instances-health.md#minimum-healthy-hosts-az).
        + (Optional) Select **Add a monitor duration for the first zone** to set a monitor duration that only applies to the first Availability Zone. You might set this option if you want to allow extra bake time for the first Availability Zone. If you don't specify a value in **Add a first zone monitor duration**, then CodeDeploy uses the **Monitor duration** value for the first Availability Zone.
        + (Optional) Under **Minimum healthy hosts per zone**, specify the number or percentage of instances that must remain available per Availability Zone during a deployment. Choose **FLEET\$1PERCENT** to specify a percentage, or **HOST\$1COUNT** to specify a number. This field works in conjunction with the **Minimum healthy hosts** field. For more information, see [About the minimum number of healthy instances per Availability Zone](instances-health.md#minimum-healthy-hosts-az).

          If you don't specify a value under **Minimum healthy hosts per zone**, then CodeDeploy uses a default value of `0` percent.
   + If you chose **AWS Lambda** or **Amazon ECS**:

     1. For **Type**, choose **Linear** or **Canary**.

     1. In the **Step** and **Interval** fields, do one of the following:
        + If you chose **Canary**, for **Step**, enter a percentage of traffic, between 1 and 99, to be shifted. This is the percentage of traffic that is shifted in the first increment. The remaining traffic is shifted after the selected interval in the second increment.

          For **Interval**, enter the number of minutes between the first and second traffic shift.
        + If you chose **Linear**, for **Step**, enter a percentage of traffic, between 1 and 99, to be shifted. This is the percentage of traffic that is shifted at the start of each interval.

          For **Interval**, enter the number of minutes between each incremental shift.

1. Choose **Create deployment configuration**.

   You now have a deployment configuration that you can associate with a deployment group.

## Creating a deployment configuration with CodeDeploy (AWS CLI)
<a name="deployment-configurations-create-cli"></a>

To use the AWS CLI to create a deployment configuration, call the [create-deployment-config](https://docs.aws.amazon.com/cli/latest/reference/deploy/create-deployment-config.html) command.



The following example creates an EC2/On-Premises deployment configuration named `ThreeQuartersHealthy` that requires 75% of target instances to remain healthy during a deployment:

```
aws deploy create-deployment-config --deployment-config-name ThreeQuartersHealthy --minimum-healthy-hosts type=FLEET_PERCENT,value=75
```



The following example creates an EC2/On-Premises deployment configuration named `300Total50PerAZ` that requires 300 target instances to remain healthy in total per deployment, and 50 to remain healthy per Availability Zone. It also sets a monitor duration of 1 hour.

```
aws deploy create-deployment-config --deployment-config-name 300Total50PerAZ --minimum-healthy-hosts type=HOST_COUNT,value=300 --zonal-config '{"monitorDurationInSeconds":3600,"minimumHealthyHostsPerZone":{"type":"HOST_COUNT","value":50}}'
```





The following example creates an AWS Lambda deployment configuration named `Canary25Percent45Minutes`. It uses canary traffic shifting to shift 25 percent of traffic in the first increment. The remaining 75 percent shifted 45 minutes later:

```
aws deploy create-deployment-config --deployment-config-name Canary25Percent45Minutes --traffic-routing-config "type="TimeBasedCanary",timeBasedCanary={canaryPercentage=25,canaryInterval=45}" --compute-platform Lambda
```



The following example creates an Amazon ECS deployment configuration named `Canary25Percent45Minutes`. It uses canary traffic shifting to shift 25 percent of traffic in the first increment. The remaining 75 percent shifted 45 minutes later:

```
aws deploy create-deployment-config --deployment-config-name Canary25Percent45Minutes --traffic-routing-config "type="TimeBasedCanary",timeBasedCanary={canaryPercentage=25,canaryInterval=45}" --compute-platform ECS
```

# View deployment configuration details with CodeDeploy
<a name="deployment-configurations-view-details"></a>

You can use the CodeDeploy console, the AWS CLI, or the CodeDeploy APIs to view details about deployment configurations associated with your AWS account. For descriptions of the predefined CodeDeploy deployment configurations, see [Predefined deployment configurations for an EC2/on-premises compute platform](deployment-configurations.md#deployment-configurations-predefined).

**Topics**
+ [

## View deployment configuration details (console)
](#deployment-configurations-view-details-console)
+ [

## View deployment configuration (CLI)
](#deployment-configurations-view-details-cli)

## View deployment configuration details (console)
<a name="deployment-configurations-view-details-console"></a>

To use the CodeDeploy console to view a list of deployment configuration names:

1. Sign in to the AWS Management Console and open the CodeDeploy console at [https://console.aws.amazon.com/codedeploy](https://console.aws.amazon.com/codedeploy).
**Note**  
Sign in with the same user that you set up in [Getting started with CodeDeploy](getting-started-codedeploy.md).

1. In the navigation pane, expand **Deploy**, and choose **Deployment configurations**.

    Here you can see the deployment configuration names and criteria for each deployment configuration. 
**Note**  
If no entries are displayed, make sure the correct region is selected. On the navigation bar, in the region selector, choose one of the regions listed in [Region and Endpoints](https://docs.aws.amazon.com/general/latest/gr/rande.html#codedeploy_region) in the *AWS General Reference*. CodeDeploy is supported in these regions only.

## View deployment configuration (CLI)
<a name="deployment-configurations-view-details-cli"></a>

To use the AWS CLI to view deployment configuration details, call either the `get-deployment-config` command or the `list-deployment-configs` command.

To view details about a single deployment configuration, call the [get-deployment-config](https://docs.aws.amazon.com/cli/latest/reference/deploy/get-deployment-config.html) command, specifying the unique deployment configuration name.

To view details about multiple deployment configurations, call the [list-deployments](https://docs.aws.amazon.com/cli/latest/reference/deploy/list-deployments.html) command.

# Delete a deployment configuration with CodeDeploy
<a name="deployment-configurations-delete"></a>

You can use the AWS CLI or the CodeDeploy APIs to delete custom deployment configurations associated with your AWS account. You cannot delete built-in deployment configurations, such as `CodeDeployDefault.AllAtOnce`, `CodeDeployDefault.HalfAtATime`, and `CodeDeployDefault.OneAtATime`.

**Warning**  
You cannot delete a custom deployment configuration that is still in use. If you delete an unused, custom deployment configuration, you will no longer be able to associate it with new deployments and new deployment groups. This action cannot be undone.

To use the AWS CLI to delete a deployment configuration, call the [delete-deployment-config](https://docs.aws.amazon.com/cli/latest/reference/deploy/delete-deployment-config.html) command, specifying the deployment configuration name. To view a list of deployment configuration names, call the [list-deployment-configs](https://docs.aws.amazon.com/cli/latest/reference/deploy/list-deployment-configs.html) command.

The following example deletes a deployment configuration named ThreeQuartersHealthy.

```
aws deploy delete-deployment-config --deployment-config-name ThreeQuartersHealthy
```