Create a deployment group (CLI) - Amazon CodeDeploy
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

Create a deployment group (CLI)

To use the Amazon CLI to create a deployment group, call the create-deployment-group command, specifying:

  • The application name. To view a list of application names, call the list-applications command.

  • A name for the deployment group. A deployment group with this name is created for the specified application. A deployment group can only be associated with one application.

  • Information about the tags, tag groups, or Amazon EC2 Auto Scaling group names that identify the instances to be included in the deployment group.

  • The Amazon Resource Name (ARN) identifier of the service role that allows CodeDeploy to act on behalf of your Amazon account when interacting with other Amazon services. To get the service role ARN, see Get the service role ARN (CLI) . For more information about service roles, see Roles terms and concepts in IAM User Guide.

  • Information about the type of deployment, either in-place or blue/green, to associate with the deployment group.

  • (Optional) The name of an existing deployment configuration. To view a list of deployment configurations, see View Deployment Configuration Details. If not specified, CodeDeploy uses a default deployment configuration.

  • (Optional) Commands to create a trigger that pushes notifications about deployment and instance events to those who are subscribed to an Amazon Simple Notification Service topic. For more information, see Monitoring Deployments with Amazon SNS Event Notifications.

  • (Optional) Commands to add existing CloudWatch alarms to the deployment group that are activated if a metric specified in an alarm falls below or exceeds a defined threshold.

  • (Optional) Commands for a deployment to roll back to the last known good revision when a deployment fails or a CloudWatch alarm is activated.

  • For in-place deployments:

    • (Optional) The name of the Classic Load Balancer or Application Load Balancer in Elastic Load Balancing that manages traffic to the instances during the deployment processes.

  • For blue/green deployments:

    • Configuration of the blue/green deployment process:

      • How new instances in the replacement environment are provisioned.

      • Whether to reroute traffic to the replacement environment immediately or wait a specified period for traffic to be rerouted manually.

      • Whether instances in the original environment should be terminated.

    • The name of the Classic Load Balancer or Application Load Balancer in Elastic Load Balancing to be used for instances registered in the replacement environment.


    If you are configuring both an Auto Scaling group and an Elastic Load Balancing load balancer in your deployment group, and you want to attach the load balancer to the Auto Scaling group, we recommend completing this attachment before creating the CodeDeploy deployment from this deployment group. Attempting to complete the attachment after creating the deployment may cause all the instances to become deregistered from the load balancer unexpectedly.