Skip to content

create_deployment_group

create_deployment_group(
    application_name: ApplicationName,
    deployment_group_name: DeploymentGroupName,
    service_role_arn: Role,
    *,
    config_overrides: Optional[CodeDeployClientConfig] = None,
    deployment_config_name: Optional[DeploymentConfigName] = None,
    ec2_tag_filters: Optional[EC2TagFilterList] = None,
    on_premises_instance_tag_filters: Optional[TagFilterList] = None,
    auto_scaling_groups: Optional[AutoScalingGroupNameList] = None,
    trigger_configurations: Optional[TriggerConfigList] = None,
    alarm_configuration: Optional[AlarmConfiguration] = None,
    auto_rollback_configuration: Optional[AutoRollbackConfiguration] = None,
    outdated_instances_strategy: Optional[OutdatedInstancesStrategy] = None,
    deployment_style: Optional[DeploymentStyle] = None,
    blue_green_deployment_configuration: Optional[
        BlueGreenDeploymentConfiguration
    ] = None,
    load_balancer_info: Optional[LoadBalancerInfo] = None,
    ec2_tag_set: Optional[EC2TagSet] = None,
    ecs_services: Optional[ECSServiceList] = None,
    on_premises_tag_set: Optional[OnPremisesTagSet] = None,
    tags: Optional[TagList] = None,
    termination_hook_enabled: Optional[NullableBoolean] = None,
) -> CreateDeploymentGroupOutput

Creates a deployment group to which application revisions are deployed.

Parameters:

  • application_name (ApplicationName) –

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

  • deployment_group_name (DeploymentGroupName) –

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

  • deployment_config_name (Optional[DeploymentConfigName], default: None ) –

    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.

  • ec2_tag_filters (Optional[EC2TagFilterList], default: None ) –

    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.

  • on_premises_instance_tag_filters (Optional[TagFilterList], default: None ) –

    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.

  • auto_scaling_groups (Optional[AutoScalingGroupNameList], default: None ) –

    A list of associated Amazon EC2 Auto Scaling groups.

  • service_role_arn (Role) –

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

  • trigger_configurations (Optional[TriggerConfigList], default: None ) –

    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.

  • alarm_configuration (Optional[AlarmConfiguration], default: None ) –

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

  • auto_rollback_configuration (Optional[AutoRollbackConfiguration], default: None ) –

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

  • outdated_instances_strategy (Optional[OutdatedInstancesStrategy], default: None ) –

    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.

  • deployment_style (Optional[DeploymentStyle], default: None ) –

    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.

  • blue_green_deployment_configuration (Optional[BlueGreenDeploymentConfiguration], default: None ) –

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

  • load_balancer_info (Optional[LoadBalancerInfo], default: None ) –

    Information about the load balancer used in a deployment.

  • ec2_tag_set (Optional[EC2TagSet], default: None ) –

    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.

  • ecs_services (Optional[ECSServiceList], default: None ) –

    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 :.

  • on_premises_tag_set (Optional[OnPremisesTagSet], default: None ) –

    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.

  • tags (Optional[TagList], default: None ) –

    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.

  • termination_hook_enabled (Optional[NullableBoolean], default: None ) –

    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.

Raises:

Source code in docs_src/capo_codedeploy/_services/code_deploy.py
def create_deployment_group(
    self,
    application_name: "capo_codedeploy.types.application_name.ApplicationName",
    deployment_group_name: "capo_codedeploy.types.deployment_group_name.DeploymentGroupName",
    service_role_arn: "capo_codedeploy.types.role.Role",
    *,
    config_overrides: Optional[CodeDeployClientConfig] = None,
    deployment_config_name: Optional[
        "capo_codedeploy.types.deployment_config_name.DeploymentConfigName"
    ] = None,
    ec2_tag_filters: Optional[
        "capo_codedeploy.types.ec2_tag_filter_list.EC2TagFilterList"
    ] = None,
    on_premises_instance_tag_filters: Optional[
        "capo_codedeploy.types.tag_filter_list.TagFilterList"
    ] = None,
    auto_scaling_groups: Optional[
        "capo_codedeploy.types.auto_scaling_group_name_list.AutoScalingGroupNameList"
    ] = None,
    trigger_configurations: Optional[
        "capo_codedeploy.types.trigger_config_list.TriggerConfigList"
    ] = None,
    alarm_configuration: Optional[
        "capo_codedeploy.types.alarm_configuration.AlarmConfiguration"
    ] = None,
    auto_rollback_configuration: Optional[
        "capo_codedeploy.types.auto_rollback_configuration.AutoRollbackConfiguration"
    ] = None,
    outdated_instances_strategy: Optional[
        "capo_codedeploy.types.outdated_instances_strategy.OutdatedInstancesStrategy"
    ] = None,
    deployment_style: Optional[
        "capo_codedeploy.types.deployment_style.DeploymentStyle"
    ] = None,
    blue_green_deployment_configuration: Optional[
        "capo_codedeploy.types.blue_green_deployment_configuration.BlueGreenDeploymentConfiguration"
    ] = None,
    load_balancer_info: Optional[
        "capo_codedeploy.types.load_balancer_info.LoadBalancerInfo"
    ] = None,
    ec2_tag_set: Optional["capo_codedeploy.types.ec2_tag_set.EC2TagSet"] = None,
    ecs_services: Optional[
        "capo_codedeploy.types.ecs_service_list.ECSServiceList"
    ] = None,
    on_premises_tag_set: Optional[
        "capo_codedeploy.types.on_premises_tag_set.OnPremisesTagSet"
    ] = None,
    tags: Optional["capo_codedeploy.types.tag_list.TagList"] = None,
    termination_hook_enabled: Optional[
        "capo_codedeploy.types.nullable_boolean.NullableBoolean"
    ] = None,
) -> "capo_codedeploy.types.create_deployment_group_output.CreateDeploymentGroupOutput":
    """<p>Creates a deployment group to which application revisions are deployed.</p>

    Args:
        application_name: <p>The name of an CodeDeploy application associated with the user or Amazon Web Services account.</p>
        deployment_group_name: <p>The name of a new deployment group for the specified application.</p>
        deployment_config_name: <p>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.</p> <p> <code>CodeDeployDefault.OneAtATime</code> is the default deployment configuration. It is used if a configuration isn't specified for the deployment or deployment group.</p> <p>For more information about the predefined deployment configurations in CodeDeploy, see <a href="https://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-configurations.html">Working with Deployment Configurations in CodeDeploy</a> in the <i>CodeDeploy User Guide</i>.</p>
        ec2_tag_filters: <p>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.</p>
        on_premises_instance_tag_filters: <p>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 <code>OnPremisesTagSet</code>.</p>
        auto_scaling_groups: <p>A list of associated Amazon EC2 Auto Scaling groups.</p>
        service_role_arn: <p>A service role Amazon Resource Name (ARN) that allows CodeDeploy to act on the user's behalf when interacting with Amazon Web Services services.</p>
        trigger_configurations: <p>Information about triggers to create when the deployment group is created. For examples, see <a href="https://docs.aws.amazon.com/codedeploy/latest/userguide/how-to-notify-sns.html">Create a Trigger for an CodeDeploy Event</a> in the <i>CodeDeploy User Guide</i>.</p>
        alarm_configuration: <p>Information to add about Amazon CloudWatch alarms when the deployment group is created.</p>
        auto_rollback_configuration: <p>Configuration information for an automatic rollback that is added when a deployment group is created.</p>
        outdated_instances_strategy: <p>Indicates what happens when new Amazon EC2 instances are launched mid-deployment and do not receive the deployed application revision.</p> <p>If this option is set to <code>UPDATE</code> 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.</p> <p>If this option is set to <code>IGNORE</code>, CodeDeploy does not initiate a deployment to update the new Amazon EC2 instances. This may result in instances having different revisions.</p>
        deployment_style: <p>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.</p>
        blue_green_deployment_configuration: <p>Information about blue/green deployment options for a deployment group.</p>
        load_balancer_info: <p>Information about the load balancer used in a deployment.</p>
        ec2_tag_set: <p>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 <code>ec2TagFilters</code>.</p>
        ecs_services: <p> 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 <code><clustername>:<servicename></code>. </p>
        on_premises_tag_set: <p>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 <code>onPremisesInstanceTagFilters</code>.</p>
        tags: <p> 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. </p>
        termination_hook_enabled: <p>This parameter only applies if you are using CodeDeploy with Amazon EC2 Auto Scaling. For more information, see <a href="https://docs.aws.amazon.com/codedeploy/latest/userguide/integrations-aws-auto-scaling.html">Integrating CodeDeploy with Amazon EC2 Auto Scaling</a> in the <i>CodeDeploy User Guide</i>.</p> <p>Set <code>terminationHookEnabled</code> to <code>true</code> 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.</p> <p>For information about termination deployments, see <a href="https://docs.aws.amazon.com/codedeploy/latest/userguide/integrations-aws-auto-scaling.html#integrations-aws-auto-scaling-behaviors-hook-enable">Enabling termination deployments during Auto Scaling scale-in events</a> in the <i>CodeDeploy User Guide</i>.</p> <p>For more information about Auto Scaling scale-in events, see the <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-lifecycle.html#as-lifecycle-scale-in">Scale in</a> topic in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p>

    Raises:
        capo_codedeploy.errors.alarms_limit_exceeded_exception.AlarmsLimitExceededException: <p>The maximum number of alarms for a deployment group (10) was exceeded.</p>
        capo_codedeploy.errors.application_does_not_exist_exception.ApplicationDoesNotExistException: <p>The application does not exist with the user or Amazon Web Services account.</p>
        capo_codedeploy.errors.application_name_required_exception.ApplicationNameRequiredException: <p>The minimum number of required application names was not specified.</p>
        capo_codedeploy.errors.deployment_config_does_not_exist_exception.DeploymentConfigDoesNotExistException: <p>The deployment configuration does not exist with the user or Amazon Web Services account.</p>
        capo_codedeploy.errors.deployment_group_already_exists_exception.DeploymentGroupAlreadyExistsException: <p>A deployment group with the specified name with the user or Amazon Web Services account already exists.</p>
        capo_codedeploy.errors.deployment_group_limit_exceeded_exception.DeploymentGroupLimitExceededException: <p> The deployment groups limit was exceeded.</p>
        capo_codedeploy.errors.deployment_group_name_required_exception.DeploymentGroupNameRequiredException: <p>The deployment group name was not specified.</p>
        capo_codedeploy.errors.ecs_service_mapping_limit_exceeded_exception.ECSServiceMappingLimitExceededException: <p> The Amazon ECS service is associated with more than one deployment groups. An Amazon ECS service can be associated with only one deployment group. </p>
        capo_codedeploy.errors.invalid_alarm_config_exception.InvalidAlarmConfigException: <p>The format of the alarm configuration is invalid. Possible causes include:</p> <ul> <li> <p>The alarm list is null.</p> </li> <li> <p>The alarm object is null.</p> </li> <li> <p>The alarm name is empty or null or exceeds the limit of 255 characters.</p> </li> <li> <p>Two alarms with the same name have been specified.</p> </li> <li> <p>The alarm configuration is enabled, but the alarm list is empty.</p> </li> </ul>
        capo_codedeploy.errors.invalid_application_name_exception.InvalidApplicationNameException: <p>The application name was specified in an invalid format.</p>
        capo_codedeploy.errors.invalid_auto_rollback_config_exception.InvalidAutoRollbackConfigException: <p>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.</p>
        capo_codedeploy.errors.invalid_auto_scaling_group_exception.InvalidAutoScalingGroupException: <p>The Auto Scaling group was specified in an invalid format or does not exist.</p>
        capo_codedeploy.errors.invalid_blue_green_deployment_configuration_exception.InvalidBlueGreenDeploymentConfigurationException: <p>The configuration for the blue/green deployment group was provided in an invalid format. For information about deployment configuration format, see <a>CreateDeploymentConfig</a>.</p>
        capo_codedeploy.errors.invalid_deployment_config_name_exception.InvalidDeploymentConfigNameException: <p>The deployment configuration name was specified in an invalid format.</p>
        capo_codedeploy.errors.invalid_deployment_group_name_exception.InvalidDeploymentGroupNameException: <p>The deployment group name was specified in an invalid format.</p>
        capo_codedeploy.errors.invalid_deployment_style_exception.InvalidDeploymentStyleException: <p>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."</p>
        capo_codedeploy.errors.invalid_ec2_tag_combination_exception.InvalidEC2TagCombinationException: <p>A call was submitted that specified both Ec2TagFilters and Ec2TagSet, but only one of these data types can be used in a single call.</p>
        capo_codedeploy.errors.invalid_ec2_tag_exception.InvalidEC2TagException: <p>The tag was specified in an invalid format.</p>
        capo_codedeploy.errors.invalid_ecs_service_exception.InvalidECSServiceException: <p> The Amazon ECS service identifier is not valid. </p>
        capo_codedeploy.errors.invalid_input_exception.InvalidInputException: <p>The input was specified in an invalid format.</p>
        capo_codedeploy.errors.invalid_load_balancer_info_exception.InvalidLoadBalancerInfoException: <p>An invalid load balancer name, or no load balancer name, was specified.</p>
        capo_codedeploy.errors.invalid_on_premises_tag_combination_exception.InvalidOnPremisesTagCombinationException: <p>A call was submitted that specified both OnPremisesTagFilters and OnPremisesTagSet, but only one of these data types can be used in a single call.</p>
        capo_codedeploy.errors.invalid_role_exception.InvalidRoleException: <p>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.</p>
        capo_codedeploy.errors.invalid_tag_exception.InvalidTagException: <p>The tag was specified in an invalid format.</p>
        capo_codedeploy.errors.invalid_tags_to_add_exception.InvalidTagsToAddException: <p> The specified tags are not valid. </p>
        capo_codedeploy.errors.invalid_target_group_pair_exception.InvalidTargetGroupPairException: <p> A target group pair associated with this deployment is not valid. </p>
        capo_codedeploy.errors.invalid_traffic_routing_configuration_exception.InvalidTrafficRoutingConfigurationException: <p> The configuration that specifies how traffic is routed during a deployment is invalid.</p>
        capo_codedeploy.errors.invalid_trigger_config_exception.InvalidTriggerConfigException: <p>The trigger was specified in an invalid format.</p>
        capo_codedeploy.errors.lifecycle_hook_limit_exceeded_exception.LifecycleHookLimitExceededException: <p>The limit for lifecycle hooks was exceeded.</p>
        capo_codedeploy.errors.role_required_exception.RoleRequiredException: <p>The role ID was not specified.</p>
        capo_codedeploy.errors.tag_set_list_limit_exceeded_exception.TagSetListLimitExceededException: <p>The number of tag groups included in the tag set list exceeded the maximum allowed limit of 3.</p>
        capo_codedeploy.errors.throttling_exception.ThrottlingException: <p>An API function was called too frequently.</p>
        capo_codedeploy.errors.trigger_targets_limit_exceeded_exception.TriggerTargetsLimitExceededException: <p>The maximum allowed number of triggers was exceeded.</p>
        capo_codedeploy.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_codedeploy.types.create_deployment_group_input.CreateDeploymentGroupInput]",
    ) -> OperationResponse[
        "capo_codedeploy.types.create_deployment_group_output.CreateDeploymentGroupOutput"
    ]:
        import capo_codedeploy._operations.code_deploy_20141006.create_deployment_group

        output, http_response = (
            capo_codedeploy._operations.code_deploy_20141006.create_deployment_group.create_deployment_group(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateDeploymentGroup")
    )
    input_: capo_codedeploy.types.create_deployment_group_input.CreateDeploymentGroupInput = {
        "application_name": application_name,
        "deployment_group_name": deployment_group_name,
        "service_role_arn": service_role_arn,
    }
    if deployment_config_name is not None:
        input_["deployment_config_name"] = deployment_config_name
    if ec2_tag_filters is not None:
        input_["ec2_tag_filters"] = ec2_tag_filters
    if on_premises_instance_tag_filters is not None:
        input_["on_premises_instance_tag_filters"] = (
            on_premises_instance_tag_filters
        )
    if auto_scaling_groups is not None:
        input_["auto_scaling_groups"] = auto_scaling_groups
    if trigger_configurations is not None:
        input_["trigger_configurations"] = trigger_configurations
    if alarm_configuration is not None:
        input_["alarm_configuration"] = alarm_configuration
    if auto_rollback_configuration is not None:
        input_["auto_rollback_configuration"] = auto_rollback_configuration
    if outdated_instances_strategy is not None:
        input_["outdated_instances_strategy"] = outdated_instances_strategy
    if deployment_style is not None:
        input_["deployment_style"] = deployment_style
    if blue_green_deployment_configuration is not None:
        input_["blue_green_deployment_configuration"] = (
            blue_green_deployment_configuration
        )
    if load_balancer_info is not None:
        input_["load_balancer_info"] = load_balancer_info
    if ec2_tag_set is not None:
        input_["ec2_tag_set"] = ec2_tag_set
    if ecs_services is not None:
        input_["ecs_services"] = ecs_services
    if on_premises_tag_set is not None:
        input_["on_premises_tag_set"] = on_premises_tag_set
    if tags is not None:
        input_["tags"] = tags
    if termination_hook_enabled is not None:
        input_["termination_hook_enabled"] = termination_hook_enabled

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output