Skip to content

update_daemon

update_daemon(
    daemon_arn: String,
    daemon_task_definition_arn: String,
    capacity_provider_arns: StringList,
    *,
    config_overrides: Optional[ECSClientConfig] = None,
    deployment_configuration: Optional[DaemonDeploymentConfiguration] = None,
    propagate_tags: Optional[DaemonPropagateTags] = None,
    enable_ecs_managed_tags: Optional[Boolean] = None,
    enable_execute_command: Optional[Boolean] = None,
    critical: Optional[BoxedBoolean] = None,
) -> UpdateDaemonResponse

Updates the specified daemon. When you update a daemon, a new deployment is triggered that progressively rolls out the changes to the container instances associated with the daemon's capacity providers. For more information, see Daemon deployments in the Amazon Elastic Container Service Developer Guide.

Amazon ECS drains existing container instances and provisions new instances with the updated daemon. Amazon ECS automatically launches replacement tasks for your services.

Updating a daemon triggers a rolling deployment that drains and replaces container instances. Plan updates during maintenance windows to minimize impact on running services.

ECS Managed Daemons is only supported for Amazon ECS Managed Instances Capacity Providers.

Parameters:

  • daemon_arn (String) –

    The Amazon Resource Name (ARN) of the daemon to update.

  • daemon_task_definition_arn (String) –

    The Amazon Resource Name (ARN) of the daemon task definition to use for the updated daemon.

  • capacity_provider_arns (StringList) –

    The Amazon Resource Names (ARNs) of the capacity providers to associate with the daemon.

  • deployment_configuration (Optional[DaemonDeploymentConfiguration], default: None ) –

    Optional deployment parameters that control how the daemon rolls out updates, including the drain percentage, alarm-based rollback, and bake time.

  • propagate_tags (Optional[DaemonPropagateTags], default: None ) –

    Specifies whether to propagate the tags from the daemon to the daemon tasks. If you don't specify a value, the tags aren't propagated. You can only propagate tags to daemon tasks during task creation.

  • enable_ecs_managed_tags (Optional[Boolean], default: None ) –

    Specifies whether to turn on Amazon ECS managed tags for the tasks in the daemon. For more information, see Tagging your Amazon ECS resources in the Amazon Elastic Container Service Developer Guide.

  • enable_execute_command (Optional[Boolean], default: None ) –

    If true, the execute command functionality is turned on for all tasks in the daemon. If false, the execute command functionality is turned off.

  • critical (Optional[BoxedBoolean], default: None ) –

    If the critical parameter of a daemon is true, and the daemon task fails, stops, or becomes unhealthy, Amazon ECS drains the container instance and stops the other tasks running on it. If the critical parameter is false, the daemon task failure doesn't affect the other tasks on the instance. The default value is true.

    A non-critical daemon doesn't block instance registration. The container instance becomes active and continues to run your other tasks, whether the daemon task fails during scale-out or during a deployment.

    Amazon ECS emits an EventBridge event when a daemon task fails to start, for both critical and non-critical daemons.

    Daemon task launch failures during a deployment are still counted by the deployment circuit breaker. The circuit breaker can roll back an unstable target revision.

Raises:

Examples:

To update a daemon This example updates the my-monitoring-daemon daemon to use a new daemon task definition revision.

>>> client.update_daemon(daemon_arn='arn:aws:ecs:us-east-1:123456789012:daemon/my-cluster/my-monitoring-daemon', daemon_task_definition_arn='arn:aws:ecs:us-east-1:123456789012:daemon-task-definition/monitoring-agent:2', capacity_provider_arns=['arn:aws:ecs:us-east-1:123456789012:capacity-provider/my-capacity-provider'], deployment_configuration={'drainPercent': 10.0, 'bakeTimeInMinutes': 5})
Source code in docs_src/capo_ecs/_services/ecs.py
def update_daemon(
    self,
    daemon_arn: "capo_ecs.types.string.String",
    daemon_task_definition_arn: "capo_ecs.types.string.String",
    capacity_provider_arns: "capo_ecs.types.string_list.StringList",
    *,
    config_overrides: Optional[ECSClientConfig] = None,
    deployment_configuration: Optional[
        "capo_ecs.types.daemon_deployment_configuration.DaemonDeploymentConfiguration"
    ] = None,
    propagate_tags: Optional[
        "capo_ecs.types.daemon_propagate_tags.DaemonPropagateTags"
    ] = None,
    enable_ecs_managed_tags: Optional["capo_ecs.types.boolean.Boolean"] = None,
    enable_execute_command: Optional["capo_ecs.types.boolean.Boolean"] = None,
    critical: Optional["capo_ecs.types.boxed_boolean.BoxedBoolean"] = None,
) -> "capo_ecs.types.update_daemon_response.UpdateDaemonResponse":
    """<p>Updates the specified daemon. When you update a daemon, a new deployment is triggered that progressively rolls out the changes to the container instances associated with the daemon's capacity providers. For more information, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/daemon-deployments.html">Daemon deployments</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.</p> <p>Amazon ECS drains existing container instances and provisions new instances with the updated daemon. Amazon ECS automatically launches replacement tasks for your services.</p> <important> <p>Updating a daemon triggers a rolling deployment that drains and replaces container instances. Plan updates during maintenance windows to minimize impact on running services.</p> </important> <note> <p>ECS Managed Daemons is only supported for Amazon ECS Managed Instances Capacity Providers.</p> </note>

    Args:
        daemon_arn: <p>The Amazon Resource Name (ARN) of the daemon to update.</p>
        daemon_task_definition_arn: <p>The Amazon Resource Name (ARN) of the daemon task definition to use for the updated daemon.</p>
        capacity_provider_arns: <p>The Amazon Resource Names (ARNs) of the capacity providers to associate with the daemon.</p>
        deployment_configuration: <p>Optional deployment parameters that control how the daemon rolls out updates, including the drain percentage, alarm-based rollback, and bake time.</p>
        propagate_tags: <p>Specifies whether to propagate the tags from the daemon to the daemon tasks. If you don't specify a value, the tags aren't propagated. You can only propagate tags to daemon tasks during task creation.</p>
        enable_ecs_managed_tags: <p>Specifies whether to turn on Amazon ECS managed tags for the tasks in the daemon. For more information, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-using-tags.html">Tagging your Amazon ECS resources</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.</p>
        enable_execute_command: <p>If <code>true</code>, the execute command functionality is turned on for all tasks in the daemon. If <code>false</code>, the execute command functionality is turned off.</p>
        critical: <p>If the <code>critical</code> parameter of a daemon is <code>true</code>, and the daemon task fails, stops, or becomes unhealthy, Amazon ECS drains the container instance and stops the other tasks running on it. If the <code>critical</code> parameter is <code>false</code>, the daemon task failure doesn't affect the other tasks on the instance. The default value is <code>true</code>.</p> <p>A non-critical daemon doesn't block instance registration. The container instance becomes active and continues to run your other tasks, whether the daemon task fails during scale-out or during a deployment.</p> <p>Amazon ECS emits an EventBridge event when a daemon task fails to start, for both critical and non-critical daemons.</p> <p>Daemon task launch failures during a deployment are still counted by the deployment circuit breaker. The circuit breaker can roll back an unstable target revision.</p>

    Raises:
        capo_ecs.errors.access_denied_exception.AccessDeniedException: <p>You don't have authorization to perform the requested action.</p>
        capo_ecs.errors.client_exception.ClientException: <p>These errors are usually caused by a client action. This client action might be using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Or, it might be specifying an identifier that isn't valid.</p>
        capo_ecs.errors.cluster_not_found_exception.ClusterNotFoundException: <p>The specified cluster wasn't found. You can view your available clusters with <a href="https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ListClusters.html">ListClusters</a>. Amazon ECS clusters are Region specific.</p>
        capo_ecs.errors.daemon_not_active_exception.DaemonNotActiveException: <p>The specified daemon isn't active. You can't update a daemon that's inactive. If you have previously deleted a daemon, you can re-create it with <a href="https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_CreateDaemon.html">CreateDaemon</a>.</p>
        capo_ecs.errors.daemon_not_found_exception.DaemonNotFoundException: <p>The specified daemon wasn't found. You can view your available daemons with <a href="https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ListDaemons.html">ListDaemons</a>. Amazon ECS daemons are cluster specific and Region specific.</p>
        capo_ecs.errors.invalid_parameter_exception.InvalidParameterException: <p>The specified parameter isn't valid. Review the available parameters for the API request.</p> <p>For more information about service event errors, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-event-messages-list.html">Amazon ECS service event messages</a>. </p>
        capo_ecs.errors.platform_unknown_exception.PlatformUnknownException: <p>The specified platform version doesn't exist.</p>
        capo_ecs.errors.server_exception.ServerException: <p>These errors are usually caused by a server issue.</p>
        capo_ecs.errors.unsupported_feature_exception.UnsupportedFeatureException: <p>The specified task isn't supported in this Region.</p>
        capo_ecs.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To update a daemon
        This example updates the my-monitoring-daemon daemon to use a new daemon task definition revision.

        >>> client.update_daemon(daemon_arn='arn:aws:ecs:us-east-1:123456789012:daemon/my-cluster/my-monitoring-daemon', daemon_task_definition_arn='arn:aws:ecs:us-east-1:123456789012:daemon-task-definition/monitoring-agent:2', capacity_provider_arns=['arn:aws:ecs:us-east-1:123456789012:capacity-provider/my-capacity-provider'], deployment_configuration={'drainPercent': 10.0, 'bakeTimeInMinutes': 5})
    """

    def _handler(
        req: "OperationRequest[capo_ecs.types.update_daemon_request.UpdateDaemonRequest]",
    ) -> OperationResponse[
        "capo_ecs.types.update_daemon_response.UpdateDaemonResponse"
    ]:
        import capo_ecs._operations.amazon_ec2_container_service_v20141113.update_daemon

        output, http_response = (
            capo_ecs._operations.amazon_ec2_container_service_v20141113.update_daemon.update_daemon(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateDaemon")
    )
    input_: capo_ecs.types.update_daemon_request.UpdateDaemonRequest = {
        "daemon_arn": daemon_arn,
        "daemon_task_definition_arn": daemon_task_definition_arn,
        "capacity_provider_arns": capacity_provider_arns,
    }
    if deployment_configuration is not None:
        input_["deployment_configuration"] = deployment_configuration
    if propagate_tags is not None:
        input_["propagate_tags"] = propagate_tags
    if enable_ecs_managed_tags is not None:
        input_["enable_ecs_managed_tags"] = enable_ecs_managed_tags
    if enable_execute_command is not None:
        input_["enable_execute_command"] = enable_execute_command
    if critical is not None:
        input_["critical"] = critical

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