CreateDeploymentGroupCommand

Creates a deployment group to which application revisions are deployed.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { CodeDeployClient, CreateDeploymentGroupCommand } from "@aws-sdk/client-codedeploy"; // ES Modules import
// const { CodeDeployClient, CreateDeploymentGroupCommand } = require("@aws-sdk/client-codedeploy"); // CommonJS import
const client = new CodeDeployClient(config);
const input = { // CreateDeploymentGroupInput
  applicationName: "STRING_VALUE", // required
  deploymentGroupName: "STRING_VALUE", // required
  deploymentConfigName: "STRING_VALUE",
  ec2TagFilters: [ // EC2TagFilterList
    { // EC2TagFilter
      Key: "STRING_VALUE",
      Value: "STRING_VALUE",
      Type: "KEY_ONLY" || "VALUE_ONLY" || "KEY_AND_VALUE",
    },
  ],
  onPremisesInstanceTagFilters: [ // TagFilterList
    { // TagFilter
      Key: "STRING_VALUE",
      Value: "STRING_VALUE",
      Type: "KEY_ONLY" || "VALUE_ONLY" || "KEY_AND_VALUE",
    },
  ],
  autoScalingGroups: [ // AutoScalingGroupNameList
    "STRING_VALUE",
  ],
  serviceRoleArn: "STRING_VALUE", // required
  triggerConfigurations: [ // TriggerConfigList
    { // TriggerConfig
      triggerName: "STRING_VALUE",
      triggerTargetArn: "STRING_VALUE",
      triggerEvents: [ // TriggerEventTypeList
        "DeploymentStart" || "DeploymentSuccess" || "DeploymentFailure" || "DeploymentStop" || "DeploymentRollback" || "DeploymentReady" || "InstanceStart" || "InstanceSuccess" || "InstanceFailure" || "InstanceReady",
      ],
    },
  ],
  alarmConfiguration: { // AlarmConfiguration
    enabled: true || false,
    ignorePollAlarmFailure: true || false,
    alarms: [ // AlarmList
      { // Alarm
        name: "STRING_VALUE",
      },
    ],
  },
  autoRollbackConfiguration: { // AutoRollbackConfiguration
    enabled: true || false,
    events: [ // AutoRollbackEventsList
      "DEPLOYMENT_FAILURE" || "DEPLOYMENT_STOP_ON_ALARM" || "DEPLOYMENT_STOP_ON_REQUEST",
    ],
  },
  outdatedInstancesStrategy: "UPDATE" || "IGNORE",
  deploymentStyle: { // DeploymentStyle
    deploymentType: "IN_PLACE" || "BLUE_GREEN",
    deploymentOption: "WITH_TRAFFIC_CONTROL" || "WITHOUT_TRAFFIC_CONTROL",
  },
  blueGreenDeploymentConfiguration: { // BlueGreenDeploymentConfiguration
    terminateBlueInstancesOnDeploymentSuccess: { // BlueInstanceTerminationOption
      action: "TERMINATE" || "KEEP_ALIVE",
      terminationWaitTimeInMinutes: Number("int"),
    },
    deploymentReadyOption: { // DeploymentReadyOption
      actionOnTimeout: "CONTINUE_DEPLOYMENT" || "STOP_DEPLOYMENT",
      waitTimeInMinutes: Number("int"),
    },
    greenFleetProvisioningOption: { // GreenFleetProvisioningOption
      action: "DISCOVER_EXISTING" || "COPY_AUTO_SCALING_GROUP",
    },
  },
  loadBalancerInfo: { // LoadBalancerInfo
    elbInfoList: [ // ELBInfoList
      { // ELBInfo
        name: "STRING_VALUE",
      },
    ],
    targetGroupInfoList: [ // TargetGroupInfoList
      { // TargetGroupInfo
        name: "STRING_VALUE",
      },
    ],
    targetGroupPairInfoList: [ // TargetGroupPairInfoList
      { // TargetGroupPairInfo
        targetGroups: [
          {
            name: "STRING_VALUE",
          },
        ],
        prodTrafficRoute: { // TrafficRoute
          listenerArns: [ // ListenerArnList
            "STRING_VALUE",
          ],
        },
        testTrafficRoute: {
          listenerArns: [
            "STRING_VALUE",
          ],
        },
      },
    ],
  },
  ec2TagSet: { // EC2TagSet
    ec2TagSetList: [ // EC2TagSetList
      [
        {
          Key: "STRING_VALUE",
          Value: "STRING_VALUE",
          Type: "KEY_ONLY" || "VALUE_ONLY" || "KEY_AND_VALUE",
        },
      ],
    ],
  },
  ecsServices: [ // ECSServiceList
    { // ECSService
      serviceName: "STRING_VALUE",
      clusterName: "STRING_VALUE",
    },
  ],
  onPremisesTagSet: { // OnPremisesTagSet
    onPremisesTagSetList: [ // OnPremisesTagSetList
      [
        {
          Key: "STRING_VALUE",
          Value: "STRING_VALUE",
          Type: "KEY_ONLY" || "VALUE_ONLY" || "KEY_AND_VALUE",
        },
      ],
    ],
  },
  tags: [ // TagList
    { // Tag
      Key: "STRING_VALUE",
      Value: "STRING_VALUE",
    },
  ],
  terminationHookEnabled: true || false,
};
const command = new CreateDeploymentGroupCommand(input);
const response = await client.send(command);
// { // CreateDeploymentGroupOutput
//   deploymentGroupId: "STRING_VALUE",
// };

CreateDeploymentGroupCommand Input

Parameter
Type
Description
applicationName
Required
string | undefined

The name of an CodeDeploy application associated with the user or Amazon Web Services account.

deploymentGroupName
Required
string | undefined

The name of a new deployment group for the specified application.

serviceRoleArn
Required
string | undefined

A service role Amazon Resource Name (ARN) that allows CodeDeploy to act on the user's behalf when interacting with Amazon Web Services services.

alarmConfiguration
AlarmConfiguration | undefined

Information to add about Amazon CloudWatch alarms when the deployment group is created.

autoRollbackConfiguration
AutoRollbackConfiguration | undefined

Configuration information for an automatic rollback that is added when a deployment group is created.

autoScalingGroups
string[] | undefined

A list of associated Amazon EC2 Auto Scaling groups.

blueGreenDeploymentConfiguration
BlueGreenDeploymentConfiguration | undefined

Information about blue/green deployment options for a deployment group.

deploymentConfigName
string | undefined

If specified, the deployment configuration name can be either one of the predefined configurations provided with CodeDeploy or a custom deployment configuration that you create by calling the create deployment configuration operation.

CodeDeployDefault.OneAtATime is the default deployment configuration. It is used if a configuration isn't specified for the deployment or deployment group.

For more information about the predefined deployment configurations in CodeDeploy, see Working with Deployment Configurations in CodeDeploy  in the CodeDeploy User Guide.

deploymentStyle
DeploymentStyle | undefined

Information about the type of deployment, in-place or blue/green, that you want to run and whether to route deployment traffic behind a load balancer.

ec2TagFilters
EC2TagFilter[] | undefined

The Amazon EC2 tags on which to filter. The deployment group includes Amazon EC2 instances with any of the specified tags. Cannot be used in the same call as ec2TagSet.

ec2TagSet
EC2TagSet | undefined

Information about groups of tags applied to Amazon EC2 instances. The deployment group includes only Amazon EC2 instances identified by all the tag groups. Cannot be used in the same call as ec2TagFilters.

ecsServices
ECSService[] | undefined

The target Amazon ECS services in the deployment group. This applies only to deployment groups that use the Amazon ECS compute platform. A target Amazon ECS service is specified as an Amazon ECS cluster and service name pair using the format :.

loadBalancerInfo
LoadBalancerInfo | undefined

Information about the load balancer used in a deployment.

onPremisesInstanceTagFilters
TagFilter[] | undefined

The on-premises instance tags on which to filter. The deployment group includes on-premises instances with any of the specified tags. Cannot be used in the same call as OnPremisesTagSet.

onPremisesTagSet
OnPremisesTagSet | undefined

Information about groups of tags applied to on-premises instances. The deployment group includes only on-premises instances identified by all of the tag groups. Cannot be used in the same call as onPremisesInstanceTagFilters.

outdatedInstancesStrategy
OutdatedInstancesStrategy | undefined

Indicates what happens when new Amazon EC2 instances are launched mid-deployment and do not receive the deployed application revision.

If this option is set to UPDATE or is unspecified, CodeDeploy initiates one or more 'auto-update outdated instances' deployments to apply the deployed application revision to the new Amazon EC2 instances.

If this option is set to IGNORE, CodeDeploy does not initiate a deployment to update the new Amazon EC2 instances. This may result in instances having different revisions.

tags
Tag[] | undefined

The metadata that you apply to CodeDeploy deployment groups to help you organize and categorize them. Each tag consists of a key and an optional value, both of which you define.

terminationHookEnabled
boolean | undefined

This parameter only applies if you are using CodeDeploy with Amazon EC2 Auto Scaling. For more information, see Integrating CodeDeploy with Amazon EC2 Auto Scaling  in the CodeDeploy User Guide.

Set terminationHookEnabled to true to have CodeDeploy install a termination hook into your Auto Scaling group when you create a deployment group. When this hook is installed, CodeDeploy will perform termination deployments.

For information about termination deployments, see Enabling termination deployments during Auto Scaling scale-in events  in the CodeDeploy User Guide.

For more information about Auto Scaling scale-in events, see the Scale in  topic in the Amazon EC2 Auto Scaling User Guide.

triggerConfigurations
TriggerConfig[] | undefined

Information about triggers to create when the deployment group is created. For examples, see Create a Trigger for an CodeDeploy Event  in the CodeDeploy User Guide.

CreateDeploymentGroupCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
deploymentGroupId
string | undefined

A unique deployment group ID.

Throws

Name
Fault
Details
AlarmsLimitExceededException
client

The maximum number of alarms for a deployment group (10) was exceeded.

ApplicationDoesNotExistException
client

The application does not exist with the user or Amazon Web Services account.

ApplicationNameRequiredException
client

The minimum number of required application names was not specified.

DeploymentConfigDoesNotExistException
client

The deployment configuration does not exist with the user or Amazon Web Services account.

DeploymentGroupAlreadyExistsException
client

A deployment group with the specified name with the user or Amazon Web Services account already exists.

DeploymentGroupLimitExceededException
client

The deployment groups limit was exceeded.

DeploymentGroupNameRequiredException
client

The deployment group name was not specified.

ECSServiceMappingLimitExceededException
client

The Amazon ECS service is associated with more than one deployment groups. An Amazon ECS service can be associated with only one deployment group.

InvalidAlarmConfigException
client

The format of the alarm configuration is invalid. Possible causes include:

  • The alarm list is null.

  • The alarm object is null.

  • The alarm name is empty or null or exceeds the limit of 255 characters.

  • Two alarms with the same name have been specified.

  • The alarm configuration is enabled, but the alarm list is empty.

InvalidApplicationNameException
client

The application name was specified in an invalid format.

InvalidAutoRollbackConfigException
client

The automatic rollback configuration was specified in an invalid format. For example, automatic rollback is enabled, but an invalid triggering event type or no event types were listed.

InvalidAutoScalingGroupException
client

The Auto Scaling group was specified in an invalid format or does not exist.

InvalidBlueGreenDeploymentConfigurationException
client

The configuration for the blue/green deployment group was provided in an invalid format. For information about deployment configuration format, see CreateDeploymentConfig.

InvalidDeploymentConfigNameException
client

The deployment configuration name was specified in an invalid format.

InvalidDeploymentGroupNameException
client

The deployment group name was specified in an invalid format.

InvalidDeploymentStyleException
client

An invalid deployment style was specified. Valid deployment types include "IN_PLACE" and "BLUE_GREEN." Valid deployment options include "WITH_TRAFFIC_CONTROL" and "WITHOUT_TRAFFIC_CONTROL."

InvalidEC2TagCombinationException
client

A call was submitted that specified both Ec2TagFilters and Ec2TagSet, but only one of these data types can be used in a single call.

InvalidEC2TagException
client

The tag was specified in an invalid format.

InvalidECSServiceException
client

The Amazon ECS service identifier is not valid.

InvalidInputException
client

The input was specified in an invalid format.

InvalidLoadBalancerInfoException
client

An invalid load balancer name, or no load balancer name, was specified.

InvalidOnPremisesTagCombinationException
client

A call was submitted that specified both OnPremisesTagFilters and OnPremisesTagSet, but only one of these data types can be used in a single call.

InvalidRoleException
client

The service role ARN was specified in an invalid format. Or, if an Auto Scaling group was specified, the specified service role does not grant the appropriate permissions to Amazon EC2 Auto Scaling.

InvalidTagException
client

The tag was specified in an invalid format.

InvalidTagsToAddException
client

The specified tags are not valid.

InvalidTargetGroupPairException
client

A target group pair associated with this deployment is not valid.

InvalidTrafficRoutingConfigurationException
client

The configuration that specifies how traffic is routed during a deployment is invalid.

InvalidTriggerConfigException
client

The trigger was specified in an invalid format.

LifecycleHookLimitExceededException
client

The limit for lifecycle hooks was exceeded.

RoleRequiredException
client

The role ID was not specified.

TagSetListLimitExceededException
client

The number of tag groups included in the tag set list exceeded the maximum allowed limit of 3.

ThrottlingException
client

An API function was called too frequently.

TriggerTargetsLimitExceededException
client

The maximum allowed number of triggers was exceeded.

CodeDeployServiceException
Base exception class for all service exceptions from CodeDeploy service.