startTask
Starts a new task from the specified task definition on the specified container instance or instances.
On March 21, 2024, a change was made to resolve the task definition revision before authorization. When a task definition revision is not specified, authorization will occur using the latest revision of a task definition.
Amazon Elastic Inference (EI) is no longer available to customers.
Alternatively, you can useRunTask
to place tasks for you. For more information, see Scheduling Tasks in the Amazon Elastic Container Service Developer Guide.
You can attach Amazon EBS volumes to Amazon ECS tasks by configuring the volume when creating or updating a service. For more information, see Amazon EBS volumes in the Amazon Elastic Container Service Developer Guide.
Samples
fun main() {
//sampleStart
// This example starts a new task in the cluster "MyCluster" on the specified container instance using
// the latest revision of the "hello-world" task definition.
val resp = ecsClient.startTask {
cluster = "MyCluster"
containerInstances = listOf<String>(
"4c543eed-f83f-47da-b1d8-3d23f1da4c64"
)
taskDefinition = "hello-world"
}
//sampleEnd
}