create_daemon
async
¶
create_daemon(
daemon_name: String,
daemon_task_definition_arn: String,
capacity_provider_arns: StringList,
*,
config_overrides: Optional[AsyncECSClientConfig] = None,
cluster_arn: Optional[String] = None,
deployment_configuration: Optional[DaemonDeploymentConfiguration] = None,
tags: Optional[Tags] = None,
propagate_tags: Optional[DaemonPropagateTags] = None,
enable_ecs_managed_tags: Optional[Boolean] = None,
enable_execute_command: Optional[Boolean] = None,
client_token: Optional[String] = None,
critical: Optional[BoxedBoolean] = None,
) -> CreateDaemonResponse
Creates a new daemon in the specified cluster and capacity providers. A daemon deploys cross-cutting software agents such as security monitoring, telemetry, and logging independently across your Amazon ECS infrastructure.
Amazon ECS deploys exactly one daemon task on each container instance of the specified capacity providers. When a container instance registers with the cluster, Amazon ECS automatically starts daemon tasks. Amazon ECS starts a daemon task before scheduling other tasks.
Daemons are essential for instance health - if a daemon task stops, Amazon ECS automatically drains and replaces that container instance.
ECS Managed Daemons is only supported for Amazon ECS Managed Instances Capacity Providers.
Parameters:
-
daemon_name(String) –The name of the daemon. Up to 255 letters (uppercase and lowercase), numbers, underscores, and hyphens are allowed.
-
cluster_arn(Optional[String], default:None) –The Amazon Resource Name (ARN) of the cluster to create the daemon in.
-
daemon_task_definition_arn(String) –The Amazon Resource Name (ARN) of the daemon task definition to use for the daemon.
-
capacity_provider_arns(StringList) –The Amazon Resource Names (ARNs) of the capacity providers to associate with the daemon. The daemon deploys tasks on container instances managed by these capacity providers.
-
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.
-
tags(Optional[Tags], default:None) –The metadata that you apply to the daemon to help you categorize and organize them. Each tag consists of a key and an optional value. You define both of them.
The following basic restrictions apply to tags:
-
Maximum number of tags per resource - 50
-
For each resource, each tag key must be unique, and each tag key can have only one value.
-
Maximum key length - 128 Unicode characters in UTF-8
-
Maximum value length - 256 Unicode characters in UTF-8
-
If your tagging schema is used across multiple services and resources, remember that other services may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : / @.
-
Tag keys and values are case-sensitive.
-
Do not use
aws:,AWS:, or any upper or lowercase combination of such as a prefix for either keys or values as it is reserved for Amazon Web Services use. You cannot edit or delete tag keys or values with this prefix. Tags with this prefix do not count against your tags per resource limit.
-
-
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. To add tags to a task after task creation, use the TagResource API action.
-
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) –Determines whether the execute command functionality is turned on for the daemon. If
true, the execute command functionality is turned on for all tasks in the daemon. -
client_token(Optional[String], default:None) –An identifier that you provide to ensure the idempotency of the request. It must be unique and is case sensitive. Up to 36 ASCII characters in the range of 33-126 (inclusive) are allowed.
-
critical(Optional[BoxedBoolean], default:None) –If the
criticalparameter of a daemon istrue, and the daemon task fails, stops, or becomes unhealthy, Amazon ECS drains the container instance and stops the other tasks running on it. If thecriticalparameter isfalse, the daemon task failure doesn't affect the other tasks on the instance. The default value istrue.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:
-
AccessDeniedException–You don't have authorization to perform the requested action.
-
ClientException–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.
-
ClusterNotFoundException–The specified cluster wasn't found. You can view your available clusters with ListClusters. Amazon ECS clusters are Region specific.
-
InvalidParameterException–The specified parameter isn't valid. Review the available parameters for the API request.
For more information about service event errors, see Amazon ECS service event messages.
-
PlatformUnknownException–The specified platform version doesn't exist.
-
ServerException–These errors are usually caused by a server issue.
-
UnsupportedFeatureException–The specified task isn't supported in this Region.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To create a daemon This example creates a daemon named my-monitoring-daemon in the specified cluster that uses the monitoring-agent daemon task definition and deploys to the specified capacity provider.
>>> await client.create_daemon(daemon_name='my-monitoring-daemon', cluster_arn='arn:aws:ecs:us-east-1:123456789012:cluster/my-cluster', daemon_task_definition_arn='arn:aws:ecs:us-east-1:123456789012:daemon-task-definition/monitoring-agent:1', 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/async_ecs.py
3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 | |