2019/09/19 - Amazon EC2 Container Service - 5 updated api methods
Changes Update ecs client to latest version
{'tasks': {'containers': {'image': 'string', 'imageDigest': 'string'}}}
Describes a specified task or tasks.
See also: AWS API Documentation
Request Syntax
client.describe_tasks( cluster='string', tasks=[ 'string', ], include=[ 'TAGS', ] )
string
The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task or tasks to describe. If you do not specify a cluster, the default cluster is assumed. This parameter is required if the task or tasks you are describing were launched in any cluster other than the default cluster.
list
[REQUIRED]
A list of up to 100 task IDs or full ARN entries.
(string) --
list
Specifies whether you want to see the resource tags for the task. If TAGS is specified, the tags are included in the response. If this field is omitted, tags are not included in the response.
(string) --
dict
Response Syntax
{ 'tasks': [ { 'taskArn': 'string', 'clusterArn': 'string', 'taskDefinitionArn': 'string', 'containerInstanceArn': 'string', 'overrides': { 'containerOverrides': [ { 'name': 'string', 'command': [ 'string', ], 'environment': [ { 'name': 'string', 'value': 'string' }, ], 'cpu': 123, 'memory': 123, 'memoryReservation': 123, 'resourceRequirements': [ { 'value': 'string', 'type': 'GPU'|'InferenceAccelerator' }, ] }, ], 'inferenceAcceleratorOverrides': [ { 'deviceName': 'string', 'deviceType': 'string' }, ], 'taskRoleArn': 'string', 'executionRoleArn': 'string' }, 'lastStatus': 'string', 'desiredStatus': 'string', 'cpu': 'string', 'memory': 'string', 'containers': [ { 'containerArn': 'string', 'taskArn': 'string', 'name': 'string', 'image': 'string', 'imageDigest': 'string', 'runtimeId': 'string', 'lastStatus': 'string', 'exitCode': 123, 'reason': 'string', 'networkBindings': [ { 'bindIP': 'string', 'containerPort': 123, 'hostPort': 123, 'protocol': 'tcp'|'udp' }, ], 'networkInterfaces': [ { 'attachmentId': 'string', 'privateIpv4Address': 'string', 'ipv6Address': 'string' }, ], 'healthStatus': 'HEALTHY'|'UNHEALTHY'|'UNKNOWN', 'cpu': 'string', 'memory': 'string', 'memoryReservation': 'string', 'gpuIds': [ 'string', ], 'firelensConfiguration': { 'type': 'fluentd'|'fluentbit', 'options': { 'string': 'string' } } }, ], 'startedBy': 'string', 'version': 123, 'stoppedReason': 'string', 'stopCode': 'TaskFailedToStart'|'EssentialContainerExited'|'UserInitiated', 'connectivity': 'CONNECTED'|'DISCONNECTED', 'connectivityAt': datetime(2015, 1, 1), 'pullStartedAt': datetime(2015, 1, 1), 'pullStoppedAt': datetime(2015, 1, 1), 'executionStoppedAt': datetime(2015, 1, 1), 'createdAt': datetime(2015, 1, 1), 'startedAt': datetime(2015, 1, 1), 'stoppingAt': datetime(2015, 1, 1), 'stoppedAt': datetime(2015, 1, 1), 'group': 'string', 'launchType': 'EC2'|'FARGATE', 'platformVersion': 'string', 'attachments': [ { 'id': 'string', 'type': 'string', 'status': 'string', 'details': [ { 'name': 'string', 'value': 'string' }, ] }, ], 'healthStatus': 'HEALTHY'|'UNHEALTHY'|'UNKNOWN', 'tags': [ { 'key': 'string', 'value': 'string' }, ], 'inferenceAccelerators': [ { 'deviceName': 'string', 'deviceType': 'string' }, ] }, ], 'failures': [ { 'arn': 'string', 'reason': 'string' }, ] }
Response Structure
(dict) --
tasks (list) --
The list of tasks.
(dict) --
Details on a task in a cluster.
taskArn (string) --
The Amazon Resource Name (ARN) of the task.
clusterArn (string) --
The ARN of the cluster that hosts the task.
taskDefinitionArn (string) --
The ARN of the task definition that creates the task.
containerInstanceArn (string) --
The ARN of the container instances that host the task.
overrides (dict) --
One or more container overrides.
containerOverrides (list) --
One or more container overrides sent to a task.
(dict) --
The overrides that should be sent to a container. An empty container override can be passed in. An example of an empty container override would be {"containerOverrides": [ ] }. If a non-empty container override is specified, the name parameter must be included.
name (string) --
The name of the container that receives the override. This parameter is required if any override is specified.
command (list) --
The command to send to the container that overrides the default command from the Docker image or the task definition. You must also specify a container name.
(string) --
environment (list) --
The environment variables to send to the container. You can add new environment variables, which are added to the container at launch, or you can override the existing environment variables from the Docker image or the task definition. You must also specify a container name.
(dict) --
A key-value pair object.
name (string) --
The name of the key-value pair. For environment variables, this is the name of the environment variable.
value (string) --
The value of the key-value pair. For environment variables, this is the value of the environment variable.
cpu (integer) --
The number of cpu units reserved for the container, instead of the default value from the task definition. You must also specify a container name.
memory (integer) --
The hard limit (in MiB) of memory to present to the container, instead of the default value from the task definition. If your container attempts to exceed the memory specified here, the container is killed. You must also specify a container name.
memoryReservation (integer) --
The soft limit (in MiB) of memory to reserve for the container, instead of the default value from the task definition. You must also specify a container name.
resourceRequirements (list) --
The type and amount of a resource to assign to a container, instead of the default value from the task definition. The only supported resource is a GPU.
(dict) --
The type and amount of a resource to assign to a container. The supported resource types are GPUs and Elastic Inference accelerators. For more information, see Working with GPUs on Amazon ECS or Working with Amazon Elastic Inference on Amazon ECS in the Amazon Elastic Container Service Developer Guide
value (string) --
The value for the specified resource type.
If the GPU type is used, the value is the number of physical GPUs the Amazon ECS container agent will reserve for the container. The number of GPUs reserved for all containers in a task should not exceed the number of available GPUs on the container instance the task is launched on.
If the InferenceAccelerator type is used, the value should match the deviceName for an InferenceAccelerator specified in a task definition.
type (string) --
The type of resource to assign to a container. The supported values are GPU or InferenceAccelerator.
inferenceAcceleratorOverrides (list) --
The Elastic Inference accelerator override for the task.
(dict) --
Details on an Elastic Inference accelerator task override. This parameter is used to override the Elastic Inference accelerator specified in the task definition. For more information, see Working with Amazon Elastic Inference on Amazon ECS in the Amazon Elastic Container Service Developer Guide.
deviceName (string) --
The Elastic Inference accelerator device name to override for the task. This parameter must match a deviceName specified in the task definition.
deviceType (string) --
The Elastic Inference accelerator type to use.
taskRoleArn (string) --
The Amazon Resource Name (ARN) of the IAM role that containers in this task can assume. All containers in this task are granted the permissions that are specified in this role.
executionRoleArn (string) --
The Amazon Resource Name (ARN) of the task execution role that the Amazon ECS container agent and the Docker daemon can assume.
lastStatus (string) --
The last known status of the task. For more information, see Task Lifecycle.
desiredStatus (string) --
The desired status of the task. For more information, see Task Lifecycle.
cpu (string) --
The number of CPU units used by the task as expressed in a task definition. It can be expressed as an integer using CPU units, for example 1024. It can also be expressed as a string using vCPUs, for example 1 vCPU or 1 vcpu. String values are converted to an integer indicating the CPU units when the task definition is registered.
If you are using the EC2 launch type, this field is optional. Supported values are between 128 CPU units ( 0.125 vCPUs) and 10240 CPU units ( 10 vCPUs).
If you are using the Fargate launch type, this field is required and you must use one of the following values, which determines your range of supported values for the memory parameter:
256 (.25 vCPU) - Available memory values: 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB)
512 (.5 vCPU) - Available memory values: 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB)
1024 (1 vCPU) - Available memory values: 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB)
2048 (2 vCPU) - Available memory values: Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB)
4096 (4 vCPU) - Available memory values: Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB)
memory (string) --
The amount of memory (in MiB) used by the task as expressed in a task definition. It can be expressed as an integer using MiB, for example 1024. It can also be expressed as a string using GB, for example 1GB or 1 GB. String values are converted to an integer indicating the MiB when the task definition is registered.
If you are using the EC2 launch type, this field is optional.
If you are using the Fargate launch type, this field is required and you must use one of the following values, which determines your range of supported values for the cpu parameter:
512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU)
1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU)
2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Available cpu values: 1024 (1 vCPU)
Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values: 2048 (2 vCPU)
Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values: 4096 (4 vCPU)
containers (list) --
The containers associated with the task.
(dict) --
A Docker container that is part of a task.
containerArn (string) --
The Amazon Resource Name (ARN) of the container.
taskArn (string) --
The ARN of the task.
name (string) --
The name of the container.
image (string) --
The image used for the container.
imageDigest (string) --
The container image manifest digest.
runtimeId (string) --
The ID of the Docker container.
lastStatus (string) --
The last known status of the container.
exitCode (integer) --
The exit code returned from the container.
reason (string) --
A short (255 max characters) human-readable string to provide additional details about a running or stopped container.
networkBindings (list) --
The network bindings associated with the container.
(dict) --
Details on the network bindings between a container and its host container instance. After a task reaches the RUNNING status, manual and automatic host and container port assignments are visible in the networkBindings section of DescribeTasks API responses.
bindIP (string) --
The IP address that the container is bound to on the container instance.
containerPort (integer) --
The port number on the container that is used with the network binding.
hostPort (integer) --
The port number on the host that is used with the network binding.
protocol (string) --
The protocol used for the network binding.
networkInterfaces (list) --
The network interfaces associated with the container.
(dict) --
An object representing the elastic network interface for tasks that use the awsvpc network mode.
attachmentId (string) --
The attachment ID for the network interface.
privateIpv4Address (string) --
The private IPv4 address for the network interface.
ipv6Address (string) --
The private IPv6 address for the network interface.
healthStatus (string) --
The health status of the container. If health checks are not configured for this container in its task definition, then it reports the health status as UNKNOWN.
cpu (string) --
The number of CPU units set for the container. The value will be 0 if no value was specified in the container definition when the task definition was registered.
memory (string) --
The hard limit (in MiB) of memory set for the container.
memoryReservation (string) --
The soft limit (in MiB) of memory set for the container.
gpuIds (list) --
The IDs of each GPU assigned to the container.
(string) --
firelensConfiguration (dict) --
The FireLens configuration for the container.
type (string) --
The log router to use. The valid values are fluentd or fluentbit.
options (dict) --
The options to use when configuring the log router. This field is optional and can be used to add additional metadata, such as the task, task definition, cluster, and container instance details to the log event. If specified, the syntax to use is "options":{"enable-ecs-log-metadata":"true|false"}.
(string) --
(string) --
startedBy (string) --
The tag specified when a task is started. If the task is started by an Amazon ECS service, then the startedBy parameter contains the deployment ID of the service that starts it.
version (integer) --
The version counter for the task. Every time a task experiences a change that triggers a CloudWatch event, the version counter is incremented. If you are replicating your Amazon ECS task state with CloudWatch Events, you can compare the version of a task reported by the Amazon ECS API actions with the version reported in CloudWatch Events for the task (inside the detail object) to verify that the version in your event stream is current.
stoppedReason (string) --
The reason that the task was stopped.
stopCode (string) --
The stop code indicating why a task was stopped. The stoppedReason may contain additional details.
connectivity (string) --
The connectivity status of a task.
connectivityAt (datetime) --
The Unix timestamp for when the task last went into CONNECTED status.
pullStartedAt (datetime) --
The Unix timestamp for when the container image pull began.
pullStoppedAt (datetime) --
The Unix timestamp for when the container image pull completed.
executionStoppedAt (datetime) --
The Unix timestamp for when the task execution stopped.
createdAt (datetime) --
The Unix timestamp for when the task was created (the task entered the PENDING state).
startedAt (datetime) --
The Unix timestamp for when the task started (the task transitioned from the PENDING state to the RUNNING state).
stoppingAt (datetime) --
The Unix timestamp for when the task stops (transitions from the RUNNING state to STOPPED).
stoppedAt (datetime) --
The Unix timestamp for when the task was stopped (the task transitioned from the RUNNING state to the STOPPED state).
group (string) --
The name of the task group associated with the task.
launchType (string) --
The launch type on which your task is running. For more information, see Amazon ECS Launch Types in the Amazon Elastic Container Service Developer Guide.
platformVersion (string) --
The platform version on which your task is running. A platform version is only specified for tasks using the Fargate launch type. If one is not specified, the LATEST platform version is used by default. For more information, see AWS Fargate Platform Versions in the Amazon Elastic Container Service Developer Guide.
attachments (list) --
The Elastic Network Adapter associated with the task if the task uses the awsvpc network mode.
(dict) --
An object representing a container instance or task attachment.
id (string) --
The unique identifier for the attachment.
type (string) --
The type of the attachment, such as ElasticNetworkInterface.
status (string) --
The status of the attachment. Valid values are PRECREATED, CREATED, ATTACHING, ATTACHED, DETACHING, DETACHED, and DELETED.
details (list) --
Details of the attachment. For elastic network interfaces, this includes the network interface ID, the MAC address, the subnet ID, and the private IPv4 address.
(dict) --
A key-value pair object.
name (string) --
The name of the key-value pair. For environment variables, this is the name of the environment variable.
value (string) --
The value of the key-value pair. For environment variables, this is the value of the environment variable.
healthStatus (string) --
The health status for the task, which is determined by the health of the essential containers in the task. If all essential containers in the task are reporting as HEALTHY, then the task status also reports as HEALTHY. If any essential containers in the task are reporting as UNHEALTHY or UNKNOWN, then the task status also reports as UNHEALTHY or UNKNOWN, accordingly.
tags (list) --
The metadata that you apply to the task to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define.
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 AWS 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.
(dict) --
The metadata that you apply to a resource to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define.
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 AWS 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.
key (string) --
One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.
value (string) --
The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).
inferenceAccelerators (list) --
The Elastic Inference accelerator associated with the task.
(dict) --
Details on a Elastic Inference accelerator. For more information, see Working with Amazon Elastic Inference on Amazon ECS in the Amazon Elastic Container Service Developer Guide.
deviceName (string) --
The Elastic Inference accelerator device name. The deviceName must also be referenced in a container definition as a ResourceRequirement.
deviceType (string) --
The Elastic Inference accelerator type to use.
failures (list) --
Any failures associated with the call.
(dict) --
A failed resource.
arn (string) --
The Amazon Resource Name (ARN) of the failed resource.
reason (string) --
The reason for the failure.
{'tasks': {'containers': {'image': 'string', 'imageDigest': 'string'}}}
Starts a new task using the specified task definition.
You can allow Amazon ECS to place tasks for you, or you can customize how Amazon ECS places tasks using placement constraints and placement strategies. For more information, see Scheduling Tasks in the Amazon Elastic Container Service Developer Guide.
Alternatively, you can use StartTask to use your own scheduler or place tasks manually on specific container instances.
The Amazon ECS API follows an eventual consistency model, due to the distributed nature of the system supporting the API. This means that the result of an API command you run that affects your Amazon ECS resources might not be immediately visible to all subsequent commands you run. Keep this in mind when you carry out an API command that immediately follows a previous API command.
To manage eventual consistency, you can do the following:
Confirm the state of the resource before you run a command to modify it. Run the DescribeTasks command using an exponential backoff algorithm to ensure that you allow enough time for the previous command to propagate through the system. To do this, run the DescribeTasks command repeatedly, starting with a couple of seconds of wait time and increasing gradually up to five minutes of wait time.
Add wait time between subsequent commands, even if the DescribeTasks command returns an accurate response. Apply an exponential backoff algorithm starting with a couple of seconds of wait time, and increase gradually up to about five minutes of wait time.
See also: AWS API Documentation
Request Syntax
client.run_task( cluster='string', taskDefinition='string', overrides={ 'containerOverrides': [ { 'name': 'string', 'command': [ 'string', ], 'environment': [ { 'name': 'string', 'value': 'string' }, ], 'cpu': 123, 'memory': 123, 'memoryReservation': 123, 'resourceRequirements': [ { 'value': 'string', 'type': 'GPU'|'InferenceAccelerator' }, ] }, ], 'inferenceAcceleratorOverrides': [ { 'deviceName': 'string', 'deviceType': 'string' }, ], 'taskRoleArn': 'string', 'executionRoleArn': 'string' }, count=123, startedBy='string', group='string', placementConstraints=[ { 'type': 'distinctInstance'|'memberOf', 'expression': 'string' }, ], placementStrategy=[ { 'type': 'random'|'spread'|'binpack', 'field': 'string' }, ], launchType='EC2'|'FARGATE', platformVersion='string', networkConfiguration={ 'awsvpcConfiguration': { 'subnets': [ 'string', ], 'securityGroups': [ 'string', ], 'assignPublicIp': 'ENABLED'|'DISABLED' } }, tags=[ { 'key': 'string', 'value': 'string' }, ], enableECSManagedTags=True|False, propagateTags='TASK_DEFINITION'|'SERVICE' )
string
The short name or full Amazon Resource Name (ARN) of the cluster on which to run your task. If you do not specify a cluster, the default cluster is assumed.
string
[REQUIRED]
The family and revision ( family:revision) or full ARN of the task definition to run. If a revision is not specified, the latest ACTIVE revision is used.
dict
A list of container overrides in JSON format that specify the name of a container in the specified task definition and the overrides it should receive. You can override the default command for a container (that is specified in the task definition or Docker image) with a command override. You can also override existing environment variables (that are specified in the task definition or Docker image) on a container or add new environment variables to it with an environment override.
containerOverrides (list) --
One or more container overrides sent to a task.
(dict) --
The overrides that should be sent to a container. An empty container override can be passed in. An example of an empty container override would be {"containerOverrides": [ ] }. If a non-empty container override is specified, the name parameter must be included.
name (string) --
The name of the container that receives the override. This parameter is required if any override is specified.
command (list) --
The command to send to the container that overrides the default command from the Docker image or the task definition. You must also specify a container name.
(string) --
environment (list) --
The environment variables to send to the container. You can add new environment variables, which are added to the container at launch, or you can override the existing environment variables from the Docker image or the task definition. You must also specify a container name.
(dict) --
A key-value pair object.
name (string) --
The name of the key-value pair. For environment variables, this is the name of the environment variable.
value (string) --
The value of the key-value pair. For environment variables, this is the value of the environment variable.
cpu (integer) --
The number of cpu units reserved for the container, instead of the default value from the task definition. You must also specify a container name.
memory (integer) --
The hard limit (in MiB) of memory to present to the container, instead of the default value from the task definition. If your container attempts to exceed the memory specified here, the container is killed. You must also specify a container name.
memoryReservation (integer) --
The soft limit (in MiB) of memory to reserve for the container, instead of the default value from the task definition. You must also specify a container name.
resourceRequirements (list) --
The type and amount of a resource to assign to a container, instead of the default value from the task definition. The only supported resource is a GPU.
(dict) --
The type and amount of a resource to assign to a container. The supported resource types are GPUs and Elastic Inference accelerators. For more information, see Working with GPUs on Amazon ECS or Working with Amazon Elastic Inference on Amazon ECS in the Amazon Elastic Container Service Developer Guide
value (string) -- [REQUIRED]
The value for the specified resource type.
If the GPU type is used, the value is the number of physical GPUs the Amazon ECS container agent will reserve for the container. The number of GPUs reserved for all containers in a task should not exceed the number of available GPUs on the container instance the task is launched on.
If the InferenceAccelerator type is used, the value should match the deviceName for an InferenceAccelerator specified in a task definition.
type (string) -- [REQUIRED]
The type of resource to assign to a container. The supported values are GPU or InferenceAccelerator.
inferenceAcceleratorOverrides (list) --
The Elastic Inference accelerator override for the task.
(dict) --
Details on an Elastic Inference accelerator task override. This parameter is used to override the Elastic Inference accelerator specified in the task definition. For more information, see Working with Amazon Elastic Inference on Amazon ECS in the Amazon Elastic Container Service Developer Guide.
deviceName (string) --
The Elastic Inference accelerator device name to override for the task. This parameter must match a deviceName specified in the task definition.
deviceType (string) --
The Elastic Inference accelerator type to use.
taskRoleArn (string) --
The Amazon Resource Name (ARN) of the IAM role that containers in this task can assume. All containers in this task are granted the permissions that are specified in this role.
executionRoleArn (string) --
The Amazon Resource Name (ARN) of the task execution role that the Amazon ECS container agent and the Docker daemon can assume.
integer
The number of instantiations of the specified task to place on your cluster. You can specify up to 10 tasks per call.
string
An optional tag specified when a task is started. For example, if you automatically trigger a task to run a batch process job, you could apply a unique identifier for that job to your task with the startedBy parameter. You can then identify which tasks belong to that job by filtering the results of a ListTasks call with the startedBy value. Up to 36 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.
If a task is started by an Amazon ECS service, then the startedBy parameter contains the deployment ID of the service that starts it.
string
The name of the task group to associate with the task. The default value is the family name of the task definition (for example, family:my-family-name).
list
An array of placement constraint objects to use for the task. You can specify up to 10 constraints per task (including constraints in the task definition and those specified at runtime).
(dict) --
An object representing a constraint on task placement. For more information, see Task Placement Constraints in the Amazon Elastic Container Service Developer Guide.
type (string) --
The type of constraint. Use distinctInstance to ensure that each task in a particular group is running on a different container instance. Use memberOf to restrict the selection to a group of valid candidates.
expression (string) --
A cluster query language expression to apply to the constraint. You cannot specify an expression if the constraint type is distinctInstance. For more information, see Cluster Query Language in the Amazon Elastic Container Service Developer Guide.
list
The placement strategy objects to use for the task. You can specify a maximum of five strategy rules per task.
(dict) --
The task placement strategy for a task or service. For more information, see Task Placement Strategies in the Amazon Elastic Container Service Developer Guide.
type (string) --
The type of placement strategy. The random placement strategy randomly places tasks on available candidates. The spread placement strategy spreads placement across available candidates evenly based on the field parameter. The binpack strategy places tasks on available candidates that have the least available amount of the resource that is specified with the field parameter. For example, if you binpack on memory, a task is placed on the instance with the least amount of remaining memory (but still enough to run the task).
field (string) --
The field to apply the placement strategy against. For the spread placement strategy, valid values are instanceId (or host, which has the same effect), or any platform or custom attribute that is applied to a container instance, such as attribute:ecs.availability-zone. For the binpack placement strategy, valid values are cpu and memory. For the random placement strategy, this field is not used.
string
The launch type on which to run your task. For more information, see Amazon ECS Launch Types in the Amazon Elastic Container Service Developer Guide.
string
The platform version the task should run. A platform version is only specified for tasks using the Fargate launch type. If one is not specified, the LATEST platform version is used by default. For more information, see AWS Fargate Platform Versions in the Amazon Elastic Container Service Developer Guide.
dict
The network configuration for the task. This parameter is required for task definitions that use the awsvpc network mode to receive their own elastic network interface, and it is not supported for other network modes. For more information, see Task Networking in the Amazon Elastic Container Service Developer Guide.
awsvpcConfiguration (dict) --
The VPC subnets and security groups associated with a task.
subnets (list) -- [REQUIRED]
The subnets associated with the task or service. There is a limit of 16 subnets that can be specified per AwsVpcConfiguration.
(string) --
securityGroups (list) --
The security groups associated with the task or service. If you do not specify a security group, the default security group for the VPC is used. There is a limit of 5 security groups that can be specified per AwsVpcConfiguration.
(string) --
assignPublicIp (string) --
Whether the task's elastic network interface receives a public IP address. The default value is DISABLED.
list
The metadata that you apply to the task to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define.
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 AWS 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.
(dict) --
The metadata that you apply to a resource to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define.
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 AWS 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.
key (string) --
One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.
value (string) --
The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).
boolean
Specifies whether to enable Amazon ECS managed tags for the task. For more information, see Tagging Your Amazon ECS Resources in the Amazon Elastic Container Service Developer Guide.
string
Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the tags are not propagated. Tags can only be propagated to the task during task creation. To add tags to a task after task creation, use the TagResource API action.
dict
Response Syntax
{ 'tasks': [ { 'taskArn': 'string', 'clusterArn': 'string', 'taskDefinitionArn': 'string', 'containerInstanceArn': 'string', 'overrides': { 'containerOverrides': [ { 'name': 'string', 'command': [ 'string', ], 'environment': [ { 'name': 'string', 'value': 'string' }, ], 'cpu': 123, 'memory': 123, 'memoryReservation': 123, 'resourceRequirements': [ { 'value': 'string', 'type': 'GPU'|'InferenceAccelerator' }, ] }, ], 'inferenceAcceleratorOverrides': [ { 'deviceName': 'string', 'deviceType': 'string' }, ], 'taskRoleArn': 'string', 'executionRoleArn': 'string' }, 'lastStatus': 'string', 'desiredStatus': 'string', 'cpu': 'string', 'memory': 'string', 'containers': [ { 'containerArn': 'string', 'taskArn': 'string', 'name': 'string', 'image': 'string', 'imageDigest': 'string', 'runtimeId': 'string', 'lastStatus': 'string', 'exitCode': 123, 'reason': 'string', 'networkBindings': [ { 'bindIP': 'string', 'containerPort': 123, 'hostPort': 123, 'protocol': 'tcp'|'udp' }, ], 'networkInterfaces': [ { 'attachmentId': 'string', 'privateIpv4Address': 'string', 'ipv6Address': 'string' }, ], 'healthStatus': 'HEALTHY'|'UNHEALTHY'|'UNKNOWN', 'cpu': 'string', 'memory': 'string', 'memoryReservation': 'string', 'gpuIds': [ 'string', ], 'firelensConfiguration': { 'type': 'fluentd'|'fluentbit', 'options': { 'string': 'string' } } }, ], 'startedBy': 'string', 'version': 123, 'stoppedReason': 'string', 'stopCode': 'TaskFailedToStart'|'EssentialContainerExited'|'UserInitiated', 'connectivity': 'CONNECTED'|'DISCONNECTED', 'connectivityAt': datetime(2015, 1, 1), 'pullStartedAt': datetime(2015, 1, 1), 'pullStoppedAt': datetime(2015, 1, 1), 'executionStoppedAt': datetime(2015, 1, 1), 'createdAt': datetime(2015, 1, 1), 'startedAt': datetime(2015, 1, 1), 'stoppingAt': datetime(2015, 1, 1), 'stoppedAt': datetime(2015, 1, 1), 'group': 'string', 'launchType': 'EC2'|'FARGATE', 'platformVersion': 'string', 'attachments': [ { 'id': 'string', 'type': 'string', 'status': 'string', 'details': [ { 'name': 'string', 'value': 'string' }, ] }, ], 'healthStatus': 'HEALTHY'|'UNHEALTHY'|'UNKNOWN', 'tags': [ { 'key': 'string', 'value': 'string' }, ], 'inferenceAccelerators': [ { 'deviceName': 'string', 'deviceType': 'string' }, ] }, ], 'failures': [ { 'arn': 'string', 'reason': 'string' }, ] }
Response Structure
(dict) --
tasks (list) --
A full description of the tasks that were run. The tasks that were successfully placed on your cluster are described here.
(dict) --
Details on a task in a cluster.
taskArn (string) --
The Amazon Resource Name (ARN) of the task.
clusterArn (string) --
The ARN of the cluster that hosts the task.
taskDefinitionArn (string) --
The ARN of the task definition that creates the task.
containerInstanceArn (string) --
The ARN of the container instances that host the task.
overrides (dict) --
One or more container overrides.
containerOverrides (list) --
One or more container overrides sent to a task.
(dict) --
The overrides that should be sent to a container. An empty container override can be passed in. An example of an empty container override would be {"containerOverrides": [ ] }. If a non-empty container override is specified, the name parameter must be included.
name (string) --
The name of the container that receives the override. This parameter is required if any override is specified.
command (list) --
The command to send to the container that overrides the default command from the Docker image or the task definition. You must also specify a container name.
(string) --
environment (list) --
The environment variables to send to the container. You can add new environment variables, which are added to the container at launch, or you can override the existing environment variables from the Docker image or the task definition. You must also specify a container name.
(dict) --
A key-value pair object.
name (string) --
The name of the key-value pair. For environment variables, this is the name of the environment variable.
value (string) --
The value of the key-value pair. For environment variables, this is the value of the environment variable.
cpu (integer) --
The number of cpu units reserved for the container, instead of the default value from the task definition. You must also specify a container name.
memory (integer) --
The hard limit (in MiB) of memory to present to the container, instead of the default value from the task definition. If your container attempts to exceed the memory specified here, the container is killed. You must also specify a container name.
memoryReservation (integer) --
The soft limit (in MiB) of memory to reserve for the container, instead of the default value from the task definition. You must also specify a container name.
resourceRequirements (list) --
The type and amount of a resource to assign to a container, instead of the default value from the task definition. The only supported resource is a GPU.
(dict) --
The type and amount of a resource to assign to a container. The supported resource types are GPUs and Elastic Inference accelerators. For more information, see Working with GPUs on Amazon ECS or Working with Amazon Elastic Inference on Amazon ECS in the Amazon Elastic Container Service Developer Guide
value (string) --
The value for the specified resource type.
If the GPU type is used, the value is the number of physical GPUs the Amazon ECS container agent will reserve for the container. The number of GPUs reserved for all containers in a task should not exceed the number of available GPUs on the container instance the task is launched on.
If the InferenceAccelerator type is used, the value should match the deviceName for an InferenceAccelerator specified in a task definition.
type (string) --
The type of resource to assign to a container. The supported values are GPU or InferenceAccelerator.
inferenceAcceleratorOverrides (list) --
The Elastic Inference accelerator override for the task.
(dict) --
Details on an Elastic Inference accelerator task override. This parameter is used to override the Elastic Inference accelerator specified in the task definition. For more information, see Working with Amazon Elastic Inference on Amazon ECS in the Amazon Elastic Container Service Developer Guide.
deviceName (string) --
The Elastic Inference accelerator device name to override for the task. This parameter must match a deviceName specified in the task definition.
deviceType (string) --
The Elastic Inference accelerator type to use.
taskRoleArn (string) --
The Amazon Resource Name (ARN) of the IAM role that containers in this task can assume. All containers in this task are granted the permissions that are specified in this role.
executionRoleArn (string) --
The Amazon Resource Name (ARN) of the task execution role that the Amazon ECS container agent and the Docker daemon can assume.
lastStatus (string) --
The last known status of the task. For more information, see Task Lifecycle.
desiredStatus (string) --
The desired status of the task. For more information, see Task Lifecycle.
cpu (string) --
The number of CPU units used by the task as expressed in a task definition. It can be expressed as an integer using CPU units, for example 1024. It can also be expressed as a string using vCPUs, for example 1 vCPU or 1 vcpu. String values are converted to an integer indicating the CPU units when the task definition is registered.
If you are using the EC2 launch type, this field is optional. Supported values are between 128 CPU units ( 0.125 vCPUs) and 10240 CPU units ( 10 vCPUs).
If you are using the Fargate launch type, this field is required and you must use one of the following values, which determines your range of supported values for the memory parameter:
256 (.25 vCPU) - Available memory values: 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB)
512 (.5 vCPU) - Available memory values: 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB)
1024 (1 vCPU) - Available memory values: 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB)
2048 (2 vCPU) - Available memory values: Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB)
4096 (4 vCPU) - Available memory values: Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB)
memory (string) --
The amount of memory (in MiB) used by the task as expressed in a task definition. It can be expressed as an integer using MiB, for example 1024. It can also be expressed as a string using GB, for example 1GB or 1 GB. String values are converted to an integer indicating the MiB when the task definition is registered.
If you are using the EC2 launch type, this field is optional.
If you are using the Fargate launch type, this field is required and you must use one of the following values, which determines your range of supported values for the cpu parameter:
512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU)
1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU)
2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Available cpu values: 1024 (1 vCPU)
Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values: 2048 (2 vCPU)
Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values: 4096 (4 vCPU)
containers (list) --
The containers associated with the task.
(dict) --
A Docker container that is part of a task.
containerArn (string) --
The Amazon Resource Name (ARN) of the container.
taskArn (string) --
The ARN of the task.
name (string) --
The name of the container.
image (string) --
The image used for the container.
imageDigest (string) --
The container image manifest digest.
runtimeId (string) --
The ID of the Docker container.
lastStatus (string) --
The last known status of the container.
exitCode (integer) --
The exit code returned from the container.
reason (string) --
A short (255 max characters) human-readable string to provide additional details about a running or stopped container.
networkBindings (list) --
The network bindings associated with the container.
(dict) --
Details on the network bindings between a container and its host container instance. After a task reaches the RUNNING status, manual and automatic host and container port assignments are visible in the networkBindings section of DescribeTasks API responses.
bindIP (string) --
The IP address that the container is bound to on the container instance.
containerPort (integer) --
The port number on the container that is used with the network binding.
hostPort (integer) --
The port number on the host that is used with the network binding.
protocol (string) --
The protocol used for the network binding.
networkInterfaces (list) --
The network interfaces associated with the container.
(dict) --
An object representing the elastic network interface for tasks that use the awsvpc network mode.
attachmentId (string) --
The attachment ID for the network interface.
privateIpv4Address (string) --
The private IPv4 address for the network interface.
ipv6Address (string) --
The private IPv6 address for the network interface.
healthStatus (string) --
The health status of the container. If health checks are not configured for this container in its task definition, then it reports the health status as UNKNOWN.
cpu (string) --
The number of CPU units set for the container. The value will be 0 if no value was specified in the container definition when the task definition was registered.
memory (string) --
The hard limit (in MiB) of memory set for the container.
memoryReservation (string) --
The soft limit (in MiB) of memory set for the container.
gpuIds (list) --
The IDs of each GPU assigned to the container.
(string) --
firelensConfiguration (dict) --
The FireLens configuration for the container.
type (string) --
The log router to use. The valid values are fluentd or fluentbit.
options (dict) --
The options to use when configuring the log router. This field is optional and can be used to add additional metadata, such as the task, task definition, cluster, and container instance details to the log event. If specified, the syntax to use is "options":{"enable-ecs-log-metadata":"true|false"}.
(string) --
(string) --
startedBy (string) --
The tag specified when a task is started. If the task is started by an Amazon ECS service, then the startedBy parameter contains the deployment ID of the service that starts it.
version (integer) --
The version counter for the task. Every time a task experiences a change that triggers a CloudWatch event, the version counter is incremented. If you are replicating your Amazon ECS task state with CloudWatch Events, you can compare the version of a task reported by the Amazon ECS API actions with the version reported in CloudWatch Events for the task (inside the detail object) to verify that the version in your event stream is current.
stoppedReason (string) --
The reason that the task was stopped.
stopCode (string) --
The stop code indicating why a task was stopped. The stoppedReason may contain additional details.
connectivity (string) --
The connectivity status of a task.
connectivityAt (datetime) --
The Unix timestamp for when the task last went into CONNECTED status.
pullStartedAt (datetime) --
The Unix timestamp for when the container image pull began.
pullStoppedAt (datetime) --
The Unix timestamp for when the container image pull completed.
executionStoppedAt (datetime) --
The Unix timestamp for when the task execution stopped.
createdAt (datetime) --
The Unix timestamp for when the task was created (the task entered the PENDING state).
startedAt (datetime) --
The Unix timestamp for when the task started (the task transitioned from the PENDING state to the RUNNING state).
stoppingAt (datetime) --
The Unix timestamp for when the task stops (transitions from the RUNNING state to STOPPED).
stoppedAt (datetime) --
The Unix timestamp for when the task was stopped (the task transitioned from the RUNNING state to the STOPPED state).
group (string) --
The name of the task group associated with the task.
launchType (string) --
The launch type on which your task is running. For more information, see Amazon ECS Launch Types in the Amazon Elastic Container Service Developer Guide.
platformVersion (string) --
The platform version on which your task is running. A platform version is only specified for tasks using the Fargate launch type. If one is not specified, the LATEST platform version is used by default. For more information, see AWS Fargate Platform Versions in the Amazon Elastic Container Service Developer Guide.
attachments (list) --
The Elastic Network Adapter associated with the task if the task uses the awsvpc network mode.
(dict) --
An object representing a container instance or task attachment.
id (string) --
The unique identifier for the attachment.
type (string) --
The type of the attachment, such as ElasticNetworkInterface.
status (string) --
The status of the attachment. Valid values are PRECREATED, CREATED, ATTACHING, ATTACHED, DETACHING, DETACHED, and DELETED.
details (list) --
Details of the attachment. For elastic network interfaces, this includes the network interface ID, the MAC address, the subnet ID, and the private IPv4 address.
(dict) --
A key-value pair object.
name (string) --
The name of the key-value pair. For environment variables, this is the name of the environment variable.
value (string) --
The value of the key-value pair. For environment variables, this is the value of the environment variable.
healthStatus (string) --
The health status for the task, which is determined by the health of the essential containers in the task. If all essential containers in the task are reporting as HEALTHY, then the task status also reports as HEALTHY. If any essential containers in the task are reporting as UNHEALTHY or UNKNOWN, then the task status also reports as UNHEALTHY or UNKNOWN, accordingly.
tags (list) --
The metadata that you apply to the task to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define.
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 AWS 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.
(dict) --
The metadata that you apply to a resource to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define.
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 AWS 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.
key (string) --
One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.
value (string) --
The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).
inferenceAccelerators (list) --
The Elastic Inference accelerator associated with the task.
(dict) --
Details on a Elastic Inference accelerator. For more information, see Working with Amazon Elastic Inference on Amazon ECS in the Amazon Elastic Container Service Developer Guide.
deviceName (string) --
The Elastic Inference accelerator device name. The deviceName must also be referenced in a container definition as a ResourceRequirement.
deviceType (string) --
The Elastic Inference accelerator type to use.
failures (list) --
Any failures associated with the call.
(dict) --
A failed resource.
arn (string) --
The Amazon Resource Name (ARN) of the failed resource.
reason (string) --
The reason for the failure.
{'tasks': {'containers': {'image': 'string', 'imageDigest': 'string'}}}
Starts a new task from the specified task definition on the specified container instance or instances.
Alternatively, you can use RunTask to place tasks for you. For more information, see Scheduling Tasks in the Amazon Elastic Container Service Developer Guide.
See also: AWS API Documentation
Request Syntax
client.start_task( cluster='string', taskDefinition='string', overrides={ 'containerOverrides': [ { 'name': 'string', 'command': [ 'string', ], 'environment': [ { 'name': 'string', 'value': 'string' }, ], 'cpu': 123, 'memory': 123, 'memoryReservation': 123, 'resourceRequirements': [ { 'value': 'string', 'type': 'GPU'|'InferenceAccelerator' }, ] }, ], 'inferenceAcceleratorOverrides': [ { 'deviceName': 'string', 'deviceType': 'string' }, ], 'taskRoleArn': 'string', 'executionRoleArn': 'string' }, containerInstances=[ 'string', ], startedBy='string', group='string', networkConfiguration={ 'awsvpcConfiguration': { 'subnets': [ 'string', ], 'securityGroups': [ 'string', ], 'assignPublicIp': 'ENABLED'|'DISABLED' } }, tags=[ { 'key': 'string', 'value': 'string' }, ], enableECSManagedTags=True|False, propagateTags='TASK_DEFINITION'|'SERVICE' )
string
The short name or full Amazon Resource Name (ARN) of the cluster on which to start your task. If you do not specify a cluster, the default cluster is assumed.
string
[REQUIRED]
The family and revision ( family:revision) or full ARN of the task definition to start. If a revision is not specified, the latest ACTIVE revision is used.
dict
A list of container overrides in JSON format that specify the name of a container in the specified task definition and the overrides it should receive. You can override the default command for a container (that is specified in the task definition or Docker image) with a command override. You can also override existing environment variables (that are specified in the task definition or Docker image) on a container or add new environment variables to it with an environment override.
containerOverrides (list) --
One or more container overrides sent to a task.
(dict) --
The overrides that should be sent to a container. An empty container override can be passed in. An example of an empty container override would be {"containerOverrides": [ ] }. If a non-empty container override is specified, the name parameter must be included.
name (string) --
The name of the container that receives the override. This parameter is required if any override is specified.
command (list) --
The command to send to the container that overrides the default command from the Docker image or the task definition. You must also specify a container name.
(string) --
environment (list) --
The environment variables to send to the container. You can add new environment variables, which are added to the container at launch, or you can override the existing environment variables from the Docker image or the task definition. You must also specify a container name.
(dict) --
A key-value pair object.
name (string) --
The name of the key-value pair. For environment variables, this is the name of the environment variable.
value (string) --
The value of the key-value pair. For environment variables, this is the value of the environment variable.
cpu (integer) --
The number of cpu units reserved for the container, instead of the default value from the task definition. You must also specify a container name.
memory (integer) --
The hard limit (in MiB) of memory to present to the container, instead of the default value from the task definition. If your container attempts to exceed the memory specified here, the container is killed. You must also specify a container name.
memoryReservation (integer) --
The soft limit (in MiB) of memory to reserve for the container, instead of the default value from the task definition. You must also specify a container name.
resourceRequirements (list) --
The type and amount of a resource to assign to a container, instead of the default value from the task definition. The only supported resource is a GPU.
(dict) --
The type and amount of a resource to assign to a container. The supported resource types are GPUs and Elastic Inference accelerators. For more information, see Working with GPUs on Amazon ECS or Working with Amazon Elastic Inference on Amazon ECS in the Amazon Elastic Container Service Developer Guide
value (string) -- [REQUIRED]
The value for the specified resource type.
If the GPU type is used, the value is the number of physical GPUs the Amazon ECS container agent will reserve for the container. The number of GPUs reserved for all containers in a task should not exceed the number of available GPUs on the container instance the task is launched on.
If the InferenceAccelerator type is used, the value should match the deviceName for an InferenceAccelerator specified in a task definition.
type (string) -- [REQUIRED]
The type of resource to assign to a container. The supported values are GPU or InferenceAccelerator.
inferenceAcceleratorOverrides (list) --
The Elastic Inference accelerator override for the task.
(dict) --
Details on an Elastic Inference accelerator task override. This parameter is used to override the Elastic Inference accelerator specified in the task definition. For more information, see Working with Amazon Elastic Inference on Amazon ECS in the Amazon Elastic Container Service Developer Guide.
deviceName (string) --
The Elastic Inference accelerator device name to override for the task. This parameter must match a deviceName specified in the task definition.
deviceType (string) --
The Elastic Inference accelerator type to use.
taskRoleArn (string) --
The Amazon Resource Name (ARN) of the IAM role that containers in this task can assume. All containers in this task are granted the permissions that are specified in this role.
executionRoleArn (string) --
The Amazon Resource Name (ARN) of the task execution role that the Amazon ECS container agent and the Docker daemon can assume.
list
[REQUIRED]
The container instance IDs or full ARN entries for the container instances on which you would like to place your task. You can specify up to 10 container instances.
(string) --
string
An optional tag specified when a task is started. For example, if you automatically trigger a task to run a batch process job, you could apply a unique identifier for that job to your task with the startedBy parameter. You can then identify which tasks belong to that job by filtering the results of a ListTasks call with the startedBy value. Up to 36 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.
If a task is started by an Amazon ECS service, then the startedBy parameter contains the deployment ID of the service that starts it.
string
The name of the task group to associate with the task. The default value is the family name of the task definition (for example, family:my-family-name).
dict
The VPC subnet and security group configuration for tasks that receive their own elastic network interface by using the awsvpc networking mode.
awsvpcConfiguration (dict) --
The VPC subnets and security groups associated with a task.
subnets (list) -- [REQUIRED]
The subnets associated with the task or service. There is a limit of 16 subnets that can be specified per AwsVpcConfiguration.
(string) --
securityGroups (list) --
The security groups associated with the task or service. If you do not specify a security group, the default security group for the VPC is used. There is a limit of 5 security groups that can be specified per AwsVpcConfiguration.
(string) --
assignPublicIp (string) --
Whether the task's elastic network interface receives a public IP address. The default value is DISABLED.
list
The metadata that you apply to the task to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define.
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 AWS 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.
(dict) --
The metadata that you apply to a resource to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define.
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 AWS 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.
key (string) --
One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.
value (string) --
The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).
boolean
Specifies whether to enable Amazon ECS managed tags for the task. For more information, see Tagging Your Amazon ECS Resources in the Amazon Elastic Container Service Developer Guide.
string
Specifies whether to propagate the tags from the task definition or the service to the task. If no value is specified, the tags are not propagated.
dict
Response Syntax
{ 'tasks': [ { 'taskArn': 'string', 'clusterArn': 'string', 'taskDefinitionArn': 'string', 'containerInstanceArn': 'string', 'overrides': { 'containerOverrides': [ { 'name': 'string', 'command': [ 'string', ], 'environment': [ { 'name': 'string', 'value': 'string' }, ], 'cpu': 123, 'memory': 123, 'memoryReservation': 123, 'resourceRequirements': [ { 'value': 'string', 'type': 'GPU'|'InferenceAccelerator' }, ] }, ], 'inferenceAcceleratorOverrides': [ { 'deviceName': 'string', 'deviceType': 'string' }, ], 'taskRoleArn': 'string', 'executionRoleArn': 'string' }, 'lastStatus': 'string', 'desiredStatus': 'string', 'cpu': 'string', 'memory': 'string', 'containers': [ { 'containerArn': 'string', 'taskArn': 'string', 'name': 'string', 'image': 'string', 'imageDigest': 'string', 'runtimeId': 'string', 'lastStatus': 'string', 'exitCode': 123, 'reason': 'string', 'networkBindings': [ { 'bindIP': 'string', 'containerPort': 123, 'hostPort': 123, 'protocol': 'tcp'|'udp' }, ], 'networkInterfaces': [ { 'attachmentId': 'string', 'privateIpv4Address': 'string', 'ipv6Address': 'string' }, ], 'healthStatus': 'HEALTHY'|'UNHEALTHY'|'UNKNOWN', 'cpu': 'string', 'memory': 'string', 'memoryReservation': 'string', 'gpuIds': [ 'string', ], 'firelensConfiguration': { 'type': 'fluentd'|'fluentbit', 'options': { 'string': 'string' } } }, ], 'startedBy': 'string', 'version': 123, 'stoppedReason': 'string', 'stopCode': 'TaskFailedToStart'|'EssentialContainerExited'|'UserInitiated', 'connectivity': 'CONNECTED'|'DISCONNECTED', 'connectivityAt': datetime(2015, 1, 1), 'pullStartedAt': datetime(2015, 1, 1), 'pullStoppedAt': datetime(2015, 1, 1), 'executionStoppedAt': datetime(2015, 1, 1), 'createdAt': datetime(2015, 1, 1), 'startedAt': datetime(2015, 1, 1), 'stoppingAt': datetime(2015, 1, 1), 'stoppedAt': datetime(2015, 1, 1), 'group': 'string', 'launchType': 'EC2'|'FARGATE', 'platformVersion': 'string', 'attachments': [ { 'id': 'string', 'type': 'string', 'status': 'string', 'details': [ { 'name': 'string', 'value': 'string' }, ] }, ], 'healthStatus': 'HEALTHY'|'UNHEALTHY'|'UNKNOWN', 'tags': [ { 'key': 'string', 'value': 'string' }, ], 'inferenceAccelerators': [ { 'deviceName': 'string', 'deviceType': 'string' }, ] }, ], 'failures': [ { 'arn': 'string', 'reason': 'string' }, ] }
Response Structure
(dict) --
tasks (list) --
A full description of the tasks that were started. Each task that was successfully placed on your container instances is described.
(dict) --
Details on a task in a cluster.
taskArn (string) --
The Amazon Resource Name (ARN) of the task.
clusterArn (string) --
The ARN of the cluster that hosts the task.
taskDefinitionArn (string) --
The ARN of the task definition that creates the task.
containerInstanceArn (string) --
The ARN of the container instances that host the task.
overrides (dict) --
One or more container overrides.
containerOverrides (list) --
One or more container overrides sent to a task.
(dict) --
The overrides that should be sent to a container. An empty container override can be passed in. An example of an empty container override would be {"containerOverrides": [ ] }. If a non-empty container override is specified, the name parameter must be included.
name (string) --
The name of the container that receives the override. This parameter is required if any override is specified.
command (list) --
The command to send to the container that overrides the default command from the Docker image or the task definition. You must also specify a container name.
(string) --
environment (list) --
The environment variables to send to the container. You can add new environment variables, which are added to the container at launch, or you can override the existing environment variables from the Docker image or the task definition. You must also specify a container name.
(dict) --
A key-value pair object.
name (string) --
The name of the key-value pair. For environment variables, this is the name of the environment variable.
value (string) --
The value of the key-value pair. For environment variables, this is the value of the environment variable.
cpu (integer) --
The number of cpu units reserved for the container, instead of the default value from the task definition. You must also specify a container name.
memory (integer) --
The hard limit (in MiB) of memory to present to the container, instead of the default value from the task definition. If your container attempts to exceed the memory specified here, the container is killed. You must also specify a container name.
memoryReservation (integer) --
The soft limit (in MiB) of memory to reserve for the container, instead of the default value from the task definition. You must also specify a container name.
resourceRequirements (list) --
The type and amount of a resource to assign to a container, instead of the default value from the task definition. The only supported resource is a GPU.
(dict) --
The type and amount of a resource to assign to a container. The supported resource types are GPUs and Elastic Inference accelerators. For more information, see Working with GPUs on Amazon ECS or Working with Amazon Elastic Inference on Amazon ECS in the Amazon Elastic Container Service Developer Guide
value (string) --
The value for the specified resource type.
If the GPU type is used, the value is the number of physical GPUs the Amazon ECS container agent will reserve for the container. The number of GPUs reserved for all containers in a task should not exceed the number of available GPUs on the container instance the task is launched on.
If the InferenceAccelerator type is used, the value should match the deviceName for an InferenceAccelerator specified in a task definition.
type (string) --
The type of resource to assign to a container. The supported values are GPU or InferenceAccelerator.
inferenceAcceleratorOverrides (list) --
The Elastic Inference accelerator override for the task.
(dict) --
Details on an Elastic Inference accelerator task override. This parameter is used to override the Elastic Inference accelerator specified in the task definition. For more information, see Working with Amazon Elastic Inference on Amazon ECS in the Amazon Elastic Container Service Developer Guide.
deviceName (string) --
The Elastic Inference accelerator device name to override for the task. This parameter must match a deviceName specified in the task definition.
deviceType (string) --
The Elastic Inference accelerator type to use.
taskRoleArn (string) --
The Amazon Resource Name (ARN) of the IAM role that containers in this task can assume. All containers in this task are granted the permissions that are specified in this role.
executionRoleArn (string) --
The Amazon Resource Name (ARN) of the task execution role that the Amazon ECS container agent and the Docker daemon can assume.
lastStatus (string) --
The last known status of the task. For more information, see Task Lifecycle.
desiredStatus (string) --
The desired status of the task. For more information, see Task Lifecycle.
cpu (string) --
The number of CPU units used by the task as expressed in a task definition. It can be expressed as an integer using CPU units, for example 1024. It can also be expressed as a string using vCPUs, for example 1 vCPU or 1 vcpu. String values are converted to an integer indicating the CPU units when the task definition is registered.
If you are using the EC2 launch type, this field is optional. Supported values are between 128 CPU units ( 0.125 vCPUs) and 10240 CPU units ( 10 vCPUs).
If you are using the Fargate launch type, this field is required and you must use one of the following values, which determines your range of supported values for the memory parameter:
256 (.25 vCPU) - Available memory values: 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB)
512 (.5 vCPU) - Available memory values: 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB)
1024 (1 vCPU) - Available memory values: 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB)
2048 (2 vCPU) - Available memory values: Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB)
4096 (4 vCPU) - Available memory values: Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB)
memory (string) --
The amount of memory (in MiB) used by the task as expressed in a task definition. It can be expressed as an integer using MiB, for example 1024. It can also be expressed as a string using GB, for example 1GB or 1 GB. String values are converted to an integer indicating the MiB when the task definition is registered.
If you are using the EC2 launch type, this field is optional.
If you are using the Fargate launch type, this field is required and you must use one of the following values, which determines your range of supported values for the cpu parameter:
512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU)
1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU)
2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Available cpu values: 1024 (1 vCPU)
Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values: 2048 (2 vCPU)
Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values: 4096 (4 vCPU)
containers (list) --
The containers associated with the task.
(dict) --
A Docker container that is part of a task.
containerArn (string) --
The Amazon Resource Name (ARN) of the container.
taskArn (string) --
The ARN of the task.
name (string) --
The name of the container.
image (string) --
The image used for the container.
imageDigest (string) --
The container image manifest digest.
runtimeId (string) --
The ID of the Docker container.
lastStatus (string) --
The last known status of the container.
exitCode (integer) --
The exit code returned from the container.
reason (string) --
A short (255 max characters) human-readable string to provide additional details about a running or stopped container.
networkBindings (list) --
The network bindings associated with the container.
(dict) --
Details on the network bindings between a container and its host container instance. After a task reaches the RUNNING status, manual and automatic host and container port assignments are visible in the networkBindings section of DescribeTasks API responses.
bindIP (string) --
The IP address that the container is bound to on the container instance.
containerPort (integer) --
The port number on the container that is used with the network binding.
hostPort (integer) --
The port number on the host that is used with the network binding.
protocol (string) --
The protocol used for the network binding.
networkInterfaces (list) --
The network interfaces associated with the container.
(dict) --
An object representing the elastic network interface for tasks that use the awsvpc network mode.
attachmentId (string) --
The attachment ID for the network interface.
privateIpv4Address (string) --
The private IPv4 address for the network interface.
ipv6Address (string) --
The private IPv6 address for the network interface.
healthStatus (string) --
The health status of the container. If health checks are not configured for this container in its task definition, then it reports the health status as UNKNOWN.
cpu (string) --
The number of CPU units set for the container. The value will be 0 if no value was specified in the container definition when the task definition was registered.
memory (string) --
The hard limit (in MiB) of memory set for the container.
memoryReservation (string) --
The soft limit (in MiB) of memory set for the container.
gpuIds (list) --
The IDs of each GPU assigned to the container.
(string) --
firelensConfiguration (dict) --
The FireLens configuration for the container.
type (string) --
The log router to use. The valid values are fluentd or fluentbit.
options (dict) --
The options to use when configuring the log router. This field is optional and can be used to add additional metadata, such as the task, task definition, cluster, and container instance details to the log event. If specified, the syntax to use is "options":{"enable-ecs-log-metadata":"true|false"}.
(string) --
(string) --
startedBy (string) --
The tag specified when a task is started. If the task is started by an Amazon ECS service, then the startedBy parameter contains the deployment ID of the service that starts it.
version (integer) --
The version counter for the task. Every time a task experiences a change that triggers a CloudWatch event, the version counter is incremented. If you are replicating your Amazon ECS task state with CloudWatch Events, you can compare the version of a task reported by the Amazon ECS API actions with the version reported in CloudWatch Events for the task (inside the detail object) to verify that the version in your event stream is current.
stoppedReason (string) --
The reason that the task was stopped.
stopCode (string) --
The stop code indicating why a task was stopped. The stoppedReason may contain additional details.
connectivity (string) --
The connectivity status of a task.
connectivityAt (datetime) --
The Unix timestamp for when the task last went into CONNECTED status.
pullStartedAt (datetime) --
The Unix timestamp for when the container image pull began.
pullStoppedAt (datetime) --
The Unix timestamp for when the container image pull completed.
executionStoppedAt (datetime) --
The Unix timestamp for when the task execution stopped.
createdAt (datetime) --
The Unix timestamp for when the task was created (the task entered the PENDING state).
startedAt (datetime) --
The Unix timestamp for when the task started (the task transitioned from the PENDING state to the RUNNING state).
stoppingAt (datetime) --
The Unix timestamp for when the task stops (transitions from the RUNNING state to STOPPED).
stoppedAt (datetime) --
The Unix timestamp for when the task was stopped (the task transitioned from the RUNNING state to the STOPPED state).
group (string) --
The name of the task group associated with the task.
launchType (string) --
The launch type on which your task is running. For more information, see Amazon ECS Launch Types in the Amazon Elastic Container Service Developer Guide.
platformVersion (string) --
The platform version on which your task is running. A platform version is only specified for tasks using the Fargate launch type. If one is not specified, the LATEST platform version is used by default. For more information, see AWS Fargate Platform Versions in the Amazon Elastic Container Service Developer Guide.
attachments (list) --
The Elastic Network Adapter associated with the task if the task uses the awsvpc network mode.
(dict) --
An object representing a container instance or task attachment.
id (string) --
The unique identifier for the attachment.
type (string) --
The type of the attachment, such as ElasticNetworkInterface.
status (string) --
The status of the attachment. Valid values are PRECREATED, CREATED, ATTACHING, ATTACHED, DETACHING, DETACHED, and DELETED.
details (list) --
Details of the attachment. For elastic network interfaces, this includes the network interface ID, the MAC address, the subnet ID, and the private IPv4 address.
(dict) --
A key-value pair object.
name (string) --
The name of the key-value pair. For environment variables, this is the name of the environment variable.
value (string) --
The value of the key-value pair. For environment variables, this is the value of the environment variable.
healthStatus (string) --
The health status for the task, which is determined by the health of the essential containers in the task. If all essential containers in the task are reporting as HEALTHY, then the task status also reports as HEALTHY. If any essential containers in the task are reporting as UNHEALTHY or UNKNOWN, then the task status also reports as UNHEALTHY or UNKNOWN, accordingly.
tags (list) --
The metadata that you apply to the task to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define.
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 AWS 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.
(dict) --
The metadata that you apply to a resource to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define.
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 AWS 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.
key (string) --
One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.
value (string) --
The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).
inferenceAccelerators (list) --
The Elastic Inference accelerator associated with the task.
(dict) --
Details on a Elastic Inference accelerator. For more information, see Working with Amazon Elastic Inference on Amazon ECS in the Amazon Elastic Container Service Developer Guide.
deviceName (string) --
The Elastic Inference accelerator device name. The deviceName must also be referenced in a container definition as a ResourceRequirement.
deviceType (string) --
The Elastic Inference accelerator type to use.
failures (list) --
Any failures associated with the call.
(dict) --
A failed resource.
arn (string) --
The Amazon Resource Name (ARN) of the failed resource.
reason (string) --
The reason for the failure.
{'task': {'containers': {'image': 'string', 'imageDigest': 'string'}}}
Stops a running task. Any tags associated with the task will be deleted.
When StopTask is called on a task, the equivalent of docker stop is issued to the containers running in the task. This results in a SIGTERM value and a default 30-second timeout, after which the SIGKILL value is sent and the containers are forcibly stopped. If the container handles the SIGTERM value gracefully and exits within 30 seconds from receiving it, no SIGKILL value is sent.
See also: AWS API Documentation
Request Syntax
client.stop_task( cluster='string', task='string', reason='string' )
string
The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task to stop. If you do not specify a cluster, the default cluster is assumed.
string
[REQUIRED]
The task ID or full Amazon Resource Name (ARN) of the task to stop.
string
An optional message specified when a task is stopped. For example, if you are using a custom scheduler, you can use this parameter to specify the reason for stopping the task here, and the message appears in subsequent DescribeTasks API operations on this task. Up to 255 characters are allowed in this message.
dict
Response Syntax
{ 'task': { 'taskArn': 'string', 'clusterArn': 'string', 'taskDefinitionArn': 'string', 'containerInstanceArn': 'string', 'overrides': { 'containerOverrides': [ { 'name': 'string', 'command': [ 'string', ], 'environment': [ { 'name': 'string', 'value': 'string' }, ], 'cpu': 123, 'memory': 123, 'memoryReservation': 123, 'resourceRequirements': [ { 'value': 'string', 'type': 'GPU'|'InferenceAccelerator' }, ] }, ], 'inferenceAcceleratorOverrides': [ { 'deviceName': 'string', 'deviceType': 'string' }, ], 'taskRoleArn': 'string', 'executionRoleArn': 'string' }, 'lastStatus': 'string', 'desiredStatus': 'string', 'cpu': 'string', 'memory': 'string', 'containers': [ { 'containerArn': 'string', 'taskArn': 'string', 'name': 'string', 'image': 'string', 'imageDigest': 'string', 'runtimeId': 'string', 'lastStatus': 'string', 'exitCode': 123, 'reason': 'string', 'networkBindings': [ { 'bindIP': 'string', 'containerPort': 123, 'hostPort': 123, 'protocol': 'tcp'|'udp' }, ], 'networkInterfaces': [ { 'attachmentId': 'string', 'privateIpv4Address': 'string', 'ipv6Address': 'string' }, ], 'healthStatus': 'HEALTHY'|'UNHEALTHY'|'UNKNOWN', 'cpu': 'string', 'memory': 'string', 'memoryReservation': 'string', 'gpuIds': [ 'string', ], 'firelensConfiguration': { 'type': 'fluentd'|'fluentbit', 'options': { 'string': 'string' } } }, ], 'startedBy': 'string', 'version': 123, 'stoppedReason': 'string', 'stopCode': 'TaskFailedToStart'|'EssentialContainerExited'|'UserInitiated', 'connectivity': 'CONNECTED'|'DISCONNECTED', 'connectivityAt': datetime(2015, 1, 1), 'pullStartedAt': datetime(2015, 1, 1), 'pullStoppedAt': datetime(2015, 1, 1), 'executionStoppedAt': datetime(2015, 1, 1), 'createdAt': datetime(2015, 1, 1), 'startedAt': datetime(2015, 1, 1), 'stoppingAt': datetime(2015, 1, 1), 'stoppedAt': datetime(2015, 1, 1), 'group': 'string', 'launchType': 'EC2'|'FARGATE', 'platformVersion': 'string', 'attachments': [ { 'id': 'string', 'type': 'string', 'status': 'string', 'details': [ { 'name': 'string', 'value': 'string' }, ] }, ], 'healthStatus': 'HEALTHY'|'UNHEALTHY'|'UNKNOWN', 'tags': [ { 'key': 'string', 'value': 'string' }, ], 'inferenceAccelerators': [ { 'deviceName': 'string', 'deviceType': 'string' }, ] } }
Response Structure
(dict) --
task (dict) --
The task that was stopped.
taskArn (string) --
The Amazon Resource Name (ARN) of the task.
clusterArn (string) --
The ARN of the cluster that hosts the task.
taskDefinitionArn (string) --
The ARN of the task definition that creates the task.
containerInstanceArn (string) --
The ARN of the container instances that host the task.
overrides (dict) --
One or more container overrides.
containerOverrides (list) --
One or more container overrides sent to a task.
(dict) --
The overrides that should be sent to a container. An empty container override can be passed in. An example of an empty container override would be {"containerOverrides": [ ] }. If a non-empty container override is specified, the name parameter must be included.
name (string) --
The name of the container that receives the override. This parameter is required if any override is specified.
command (list) --
The command to send to the container that overrides the default command from the Docker image or the task definition. You must also specify a container name.
(string) --
environment (list) --
The environment variables to send to the container. You can add new environment variables, which are added to the container at launch, or you can override the existing environment variables from the Docker image or the task definition. You must also specify a container name.
(dict) --
A key-value pair object.
name (string) --
The name of the key-value pair. For environment variables, this is the name of the environment variable.
value (string) --
The value of the key-value pair. For environment variables, this is the value of the environment variable.
cpu (integer) --
The number of cpu units reserved for the container, instead of the default value from the task definition. You must also specify a container name.
memory (integer) --
The hard limit (in MiB) of memory to present to the container, instead of the default value from the task definition. If your container attempts to exceed the memory specified here, the container is killed. You must also specify a container name.
memoryReservation (integer) --
The soft limit (in MiB) of memory to reserve for the container, instead of the default value from the task definition. You must also specify a container name.
resourceRequirements (list) --
The type and amount of a resource to assign to a container, instead of the default value from the task definition. The only supported resource is a GPU.
(dict) --
The type and amount of a resource to assign to a container. The supported resource types are GPUs and Elastic Inference accelerators. For more information, see Working with GPUs on Amazon ECS or Working with Amazon Elastic Inference on Amazon ECS in the Amazon Elastic Container Service Developer Guide
value (string) --
The value for the specified resource type.
If the GPU type is used, the value is the number of physical GPUs the Amazon ECS container agent will reserve for the container. The number of GPUs reserved for all containers in a task should not exceed the number of available GPUs on the container instance the task is launched on.
If the InferenceAccelerator type is used, the value should match the deviceName for an InferenceAccelerator specified in a task definition.
type (string) --
The type of resource to assign to a container. The supported values are GPU or InferenceAccelerator.
inferenceAcceleratorOverrides (list) --
The Elastic Inference accelerator override for the task.
(dict) --
Details on an Elastic Inference accelerator task override. This parameter is used to override the Elastic Inference accelerator specified in the task definition. For more information, see Working with Amazon Elastic Inference on Amazon ECS in the Amazon Elastic Container Service Developer Guide.
deviceName (string) --
The Elastic Inference accelerator device name to override for the task. This parameter must match a deviceName specified in the task definition.
deviceType (string) --
The Elastic Inference accelerator type to use.
taskRoleArn (string) --
The Amazon Resource Name (ARN) of the IAM role that containers in this task can assume. All containers in this task are granted the permissions that are specified in this role.
executionRoleArn (string) --
The Amazon Resource Name (ARN) of the task execution role that the Amazon ECS container agent and the Docker daemon can assume.
lastStatus (string) --
The last known status of the task. For more information, see Task Lifecycle.
desiredStatus (string) --
The desired status of the task. For more information, see Task Lifecycle.
cpu (string) --
The number of CPU units used by the task as expressed in a task definition. It can be expressed as an integer using CPU units, for example 1024. It can also be expressed as a string using vCPUs, for example 1 vCPU or 1 vcpu. String values are converted to an integer indicating the CPU units when the task definition is registered.
If you are using the EC2 launch type, this field is optional. Supported values are between 128 CPU units ( 0.125 vCPUs) and 10240 CPU units ( 10 vCPUs).
If you are using the Fargate launch type, this field is required and you must use one of the following values, which determines your range of supported values for the memory parameter:
256 (.25 vCPU) - Available memory values: 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB)
512 (.5 vCPU) - Available memory values: 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB)
1024 (1 vCPU) - Available memory values: 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB)
2048 (2 vCPU) - Available memory values: Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB)
4096 (4 vCPU) - Available memory values: Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB)
memory (string) --
The amount of memory (in MiB) used by the task as expressed in a task definition. It can be expressed as an integer using MiB, for example 1024. It can also be expressed as a string using GB, for example 1GB or 1 GB. String values are converted to an integer indicating the MiB when the task definition is registered.
If you are using the EC2 launch type, this field is optional.
If you are using the Fargate launch type, this field is required and you must use one of the following values, which determines your range of supported values for the cpu parameter:
512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU)
1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU)
2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Available cpu values: 1024 (1 vCPU)
Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values: 2048 (2 vCPU)
Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values: 4096 (4 vCPU)
containers (list) --
The containers associated with the task.
(dict) --
A Docker container that is part of a task.
containerArn (string) --
The Amazon Resource Name (ARN) of the container.
taskArn (string) --
The ARN of the task.
name (string) --
The name of the container.
image (string) --
The image used for the container.
imageDigest (string) --
The container image manifest digest.
runtimeId (string) --
The ID of the Docker container.
lastStatus (string) --
The last known status of the container.
exitCode (integer) --
The exit code returned from the container.
reason (string) --
A short (255 max characters) human-readable string to provide additional details about a running or stopped container.
networkBindings (list) --
The network bindings associated with the container.
(dict) --
Details on the network bindings between a container and its host container instance. After a task reaches the RUNNING status, manual and automatic host and container port assignments are visible in the networkBindings section of DescribeTasks API responses.
bindIP (string) --
The IP address that the container is bound to on the container instance.
containerPort (integer) --
The port number on the container that is used with the network binding.
hostPort (integer) --
The port number on the host that is used with the network binding.
protocol (string) --
The protocol used for the network binding.
networkInterfaces (list) --
The network interfaces associated with the container.
(dict) --
An object representing the elastic network interface for tasks that use the awsvpc network mode.
attachmentId (string) --
The attachment ID for the network interface.
privateIpv4Address (string) --
The private IPv4 address for the network interface.
ipv6Address (string) --
The private IPv6 address for the network interface.
healthStatus (string) --
The health status of the container. If health checks are not configured for this container in its task definition, then it reports the health status as UNKNOWN.
cpu (string) --
The number of CPU units set for the container. The value will be 0 if no value was specified in the container definition when the task definition was registered.
memory (string) --
The hard limit (in MiB) of memory set for the container.
memoryReservation (string) --
The soft limit (in MiB) of memory set for the container.
gpuIds (list) --
The IDs of each GPU assigned to the container.
(string) --
firelensConfiguration (dict) --
The FireLens configuration for the container.
type (string) --
The log router to use. The valid values are fluentd or fluentbit.
options (dict) --
The options to use when configuring the log router. This field is optional and can be used to add additional metadata, such as the task, task definition, cluster, and container instance details to the log event. If specified, the syntax to use is "options":{"enable-ecs-log-metadata":"true|false"}.
(string) --
(string) --
startedBy (string) --
The tag specified when a task is started. If the task is started by an Amazon ECS service, then the startedBy parameter contains the deployment ID of the service that starts it.
version (integer) --
The version counter for the task. Every time a task experiences a change that triggers a CloudWatch event, the version counter is incremented. If you are replicating your Amazon ECS task state with CloudWatch Events, you can compare the version of a task reported by the Amazon ECS API actions with the version reported in CloudWatch Events for the task (inside the detail object) to verify that the version in your event stream is current.
stoppedReason (string) --
The reason that the task was stopped.
stopCode (string) --
The stop code indicating why a task was stopped. The stoppedReason may contain additional details.
connectivity (string) --
The connectivity status of a task.
connectivityAt (datetime) --
The Unix timestamp for when the task last went into CONNECTED status.
pullStartedAt (datetime) --
The Unix timestamp for when the container image pull began.
pullStoppedAt (datetime) --
The Unix timestamp for when the container image pull completed.
executionStoppedAt (datetime) --
The Unix timestamp for when the task execution stopped.
createdAt (datetime) --
The Unix timestamp for when the task was created (the task entered the PENDING state).
startedAt (datetime) --
The Unix timestamp for when the task started (the task transitioned from the PENDING state to the RUNNING state).
stoppingAt (datetime) --
The Unix timestamp for when the task stops (transitions from the RUNNING state to STOPPED).
stoppedAt (datetime) --
The Unix timestamp for when the task was stopped (the task transitioned from the RUNNING state to the STOPPED state).
group (string) --
The name of the task group associated with the task.
launchType (string) --
The launch type on which your task is running. For more information, see Amazon ECS Launch Types in the Amazon Elastic Container Service Developer Guide.
platformVersion (string) --
The platform version on which your task is running. A platform version is only specified for tasks using the Fargate launch type. If one is not specified, the LATEST platform version is used by default. For more information, see AWS Fargate Platform Versions in the Amazon Elastic Container Service Developer Guide.
attachments (list) --
The Elastic Network Adapter associated with the task if the task uses the awsvpc network mode.
(dict) --
An object representing a container instance or task attachment.
id (string) --
The unique identifier for the attachment.
type (string) --
The type of the attachment, such as ElasticNetworkInterface.
status (string) --
The status of the attachment. Valid values are PRECREATED, CREATED, ATTACHING, ATTACHED, DETACHING, DETACHED, and DELETED.
details (list) --
Details of the attachment. For elastic network interfaces, this includes the network interface ID, the MAC address, the subnet ID, and the private IPv4 address.
(dict) --
A key-value pair object.
name (string) --
The name of the key-value pair. For environment variables, this is the name of the environment variable.
value (string) --
The value of the key-value pair. For environment variables, this is the value of the environment variable.
healthStatus (string) --
The health status for the task, which is determined by the health of the essential containers in the task. If all essential containers in the task are reporting as HEALTHY, then the task status also reports as HEALTHY. If any essential containers in the task are reporting as UNHEALTHY or UNKNOWN, then the task status also reports as UNHEALTHY or UNKNOWN, accordingly.
tags (list) --
The metadata that you apply to the task to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define.
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 AWS 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.
(dict) --
The metadata that you apply to a resource to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define.
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 AWS 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.
key (string) --
One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.
value (string) --
The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).
inferenceAccelerators (list) --
The Elastic Inference accelerator associated with the task.
(dict) --
Details on a Elastic Inference accelerator. For more information, see Working with Amazon Elastic Inference on Amazon ECS in the Amazon Elastic Container Service Developer Guide.
deviceName (string) --
The Elastic Inference accelerator device name. The deviceName must also be referenced in a container definition as a ResourceRequirement.
deviceType (string) --
The Elastic Inference accelerator type to use.
{'containers': {'imageDigest': 'string'}}
Sent to acknowledge that a task changed states.
See also: AWS API Documentation
Request Syntax
client.submit_task_state_change( cluster='string', task='string', status='string', reason='string', containers=[ { 'containerName': 'string', 'imageDigest': 'string', 'runtimeId': 'string', 'exitCode': 123, 'networkBindings': [ { 'bindIP': 'string', 'containerPort': 123, 'hostPort': 123, 'protocol': 'tcp'|'udp' }, ], 'reason': 'string', 'status': 'string' }, ], attachments=[ { 'attachmentArn': 'string', 'status': 'string' }, ], pullStartedAt=datetime(2015, 1, 1), pullStoppedAt=datetime(2015, 1, 1), executionStoppedAt=datetime(2015, 1, 1) )
string
The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task.
string
The task ID or full ARN of the task in the state change request.
string
The status of the state change request.
string
The reason for the state change request.
list
Any containers associated with the state change request.
(dict) --
An object representing a change in state for a container.
containerName (string) --
The name of the container.
imageDigest (string) --
The container image SHA 256 digest.
runtimeId (string) --
The ID of the Docker container.
exitCode (integer) --
The exit code for the container, if the state change is a result of the container exiting.
networkBindings (list) --
Any network bindings associated with the container.
(dict) --
Details on the network bindings between a container and its host container instance. After a task reaches the RUNNING status, manual and automatic host and container port assignments are visible in the networkBindings section of DescribeTasks API responses.
bindIP (string) --
The IP address that the container is bound to on the container instance.
containerPort (integer) --
The port number on the container that is used with the network binding.
hostPort (integer) --
The port number on the host that is used with the network binding.
protocol (string) --
The protocol used for the network binding.
reason (string) --
The reason for the state change.
status (string) --
The status of the container.
list
Any attachments associated with the state change request.
(dict) --
An object representing a change in state for a task attachment.
attachmentArn (string) -- [REQUIRED]
The Amazon Resource Name (ARN) of the attachment.
status (string) -- [REQUIRED]
The status of the attachment.
datetime
The Unix timestamp for when the container image pull began.
datetime
The Unix timestamp for when the container image pull completed.
datetime
The Unix timestamp for when the task execution stopped.
dict
Response Syntax
{ 'acknowledgment': 'string' }
Response Structure
(dict) --
acknowledgment (string) --
Acknowledgement of the state change.