createDaemon

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.

Samples

import aws.sdk.kotlin.services.ecs.model.DaemonDeploymentConfiguration

fun main() { 
   //sampleStart 
   // 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.
val resp = ecsClient.createDaemon {
    daemonName = "my-monitoring-daemon"
    clusterArn = "arn:aws:ecs:us-east-1:123456789012:cluster/my-cluster"
    daemonTaskDefinitionArn = "arn:aws:ecs:us-east-1:123456789012:daemon-task-definition/monitoring-agent:1"
    capacityProviderArns = listOf<String>(
        "arn:aws:ecs:us-east-1:123456789012:capacity-provider/my-capacity-provider"
    )
    deploymentConfiguration = DaemonDeploymentConfiguration {
        drainPercent = 10.0.toDouble()
        bakeTimeInMinutes = 5
    }
} 
   //sampleEnd
}