Skip to content

update_deployment_group

update_deployment_group(
    application_name: ApplicationName,
    current_deployment_group_name: DeploymentGroupName,
    *,
    config_overrides: Optional[CodeDeployClientConfig] = None,
    new_deployment_group_name: Optional[DeploymentGroupName] = 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,
    service_role_arn: Optional[Role] = 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,
    termination_hook_enabled: Optional[NullableBoolean] = None,
) -> UpdateDeploymentGroupOutput

Changes information about a deployment group.

Parameters:

  • application_name (ApplicationName) –

    The application name that corresponds to the deployment group to update.

  • current_deployment_group_name (DeploymentGroupName) –

    The current name of the deployment group.

  • new_deployment_group_name (Optional[DeploymentGroupName], default: None ) –

    The new name of the deployment group, if you want to change it.

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

    The replacement deployment configuration name to use, if you want to change it.

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

    The replacement set of Amazon EC2 tags on which to filter, if you want to change them. To keep the existing tags, enter their names. To remove tags, do not enter any tag names.

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

    The replacement set of on-premises instance tags on which to filter, if you want to change them. To keep the existing tags, enter their names. To remove tags, do not enter any tag names.

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

    The replacement list of Auto Scaling groups to be included in the deployment group, if you want to change them.

  • service_role_arn (Optional[Role], default: None ) –

    A replacement ARN for the service role, if you want to change it.

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

    Information about triggers to change when the deployment group is updated. For examples, see Edit a Trigger in a CodeDeploy Deployment Group in the CodeDeploy User Guide.

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

    Information to add or change about Amazon CloudWatch alarms when the deployment group is updated.

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

    Information for an automatic rollback configuration that is added or changed when a deployment group is updated.

  • 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, either in-place or blue/green, 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 on-premises instances. The deployment group includes only Amazon EC2 instances identified by all the tag groups.

  • 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 an on-premises instance tag set. The deployment group includes only on-premises instances identified by all the tag groups.

  • 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 update 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 update_deployment_group(
    self,
    application_name: "capo_codedeploy.types.application_name.ApplicationName",
    current_deployment_group_name: "capo_codedeploy.types.deployment_group_name.DeploymentGroupName",
    *,
    config_overrides: Optional[CodeDeployClientConfig] = None,
    new_deployment_group_name: Optional[
        "capo_codedeploy.types.deployment_group_name.DeploymentGroupName"
    ] = 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,
    service_role_arn: Optional["capo_codedeploy.types.role.Role"] = 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,
    termination_hook_enabled: Optional[
        "capo_codedeploy.types.nullable_boolean.NullableBoolean"
    ] = None,
) -> "capo_codedeploy.types.update_deployment_group_output.UpdateDeploymentGroupOutput":
    """<p>Changes information about a deployment group.</p>

    Args:
        application_name: <p>The application name that corresponds to the deployment group to update.</p>
        current_deployment_group_name: <p>The current name of the deployment group.</p>
        new_deployment_group_name: <p>The new name of the deployment group, if you want to change it.</p>
        deployment_config_name: <p>The replacement deployment configuration name to use, if you want to change it.</p>
        ec2_tag_filters: <p>The replacement set of Amazon EC2 tags on which to filter, if you want to change them. To keep the existing tags, enter their names. To remove tags, do not enter any tag names.</p>
        on_premises_instance_tag_filters: <p>The replacement set of on-premises instance tags on which to filter, if you want to change them. To keep the existing tags, enter their names. To remove tags, do not enter any tag names.</p>
        auto_scaling_groups: <p>The replacement list of Auto Scaling groups to be included in the deployment group, if you want to change them.</p> <ul> <li> <p>To keep the Auto Scaling groups, enter their names or do not specify this parameter. </p> </li> <li> <p>To remove Auto Scaling groups, specify a non-null empty list of Auto Scaling group names to detach all CodeDeploy-managed Auto Scaling lifecycle hooks. For examples, see <a href="https://docs.aws.amazon.com/codedeploy/latest/userguide/troubleshooting-auto-scaling.html#troubleshooting-auto-scaling-heartbeat">Amazon EC2 instances in an Amazon EC2 Auto Scaling group fail to launch and receive the error "Heartbeat Timeout"</a> in the <i>CodeDeploy User Guide</i>.</p> </li> </ul>
        service_role_arn: <p>A replacement ARN for the service role, if you want to change it.</p>
        trigger_configurations: <p>Information about triggers to change when the deployment group is updated. For examples, see <a href="https://docs.aws.amazon.com/codedeploy/latest/userguide/how-to-notify-edit.html">Edit a Trigger in a CodeDeploy Deployment Group</a> in the <i>CodeDeploy User Guide</i>.</p>
        alarm_configuration: <p>Information to add or change about Amazon CloudWatch alarms when the deployment group is updated.</p>
        auto_rollback_configuration: <p>Information for an automatic rollback configuration that is added or changed when a deployment group is updated.</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, either in-place or blue/green, 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 on-premises instances. The deployment group includes only Amazon EC2 instances identified by all the tag groups.</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 an on-premises instance tag set. The deployment group includes only on-premises instances identified by all the tag groups.</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 update 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_does_not_exist_exception.DeploymentGroupDoesNotExistException: <p>The named deployment group with the user or Amazon Web Services account does not exist.</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_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.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.update_deployment_group_input.UpdateDeploymentGroupInput]",
    ) -> OperationResponse[
        "capo_codedeploy.types.update_deployment_group_output.UpdateDeploymentGroupOutput"
    ]:
        import capo_codedeploy._operations.code_deploy_20141006.update_deployment_group

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateDeploymentGroup")
    )
    input_: capo_codedeploy.types.update_deployment_group_input.UpdateDeploymentGroupInput = {
        "application_name": application_name,
        "current_deployment_group_name": current_deployment_group_name,
    }
    if new_deployment_group_name is not None:
        input_["new_deployment_group_name"] = new_deployment_group_name
    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 service_role_arn is not None:
        input_["service_role_arn"] = service_role_arn
    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 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