AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Starts a new task using the specified task definition.
On March 21, 2024, a change was made to resolve the task definition revision before
authorization. When a task definition revision is not specified, authorization will
occur using the latest revision of a task definition.
Amazon Elastic Inference (EI) is no longer available to customers.
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.
You can attach Amazon EBS volumes to Amazon ECS tasks by configuring the volume when creating or updating a service. For more information, see Amazon EBS volumes in the Amazon Elastic Container Service Developer Guide.
The Amazon ECS API follows an eventual consistency model. This is because of 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.
If you get a ConflictException
error, the RunTask
request could not
be processed due to conflicts. The provided clientToken
is already in use with
a different RunTask
request. The resourceIds
are the existing task ARNs
which are already associated with the clientToken
.
To fix this issue:
Run RunTask
with a unique clientToken
.
Run RunTask
with the clientToken
and the original set of parameters
If you get a ClientException
error, the RunTask
could not be processed
because you use managed scaling and there is a capacity error because the quota of
tasks in the PROVISIONING
per cluster has been reached. For information about
the service quotas, see Amazon
ECS service quotas.
This is an asynchronous operation using the standard naming convention for .NET 4.5 or higher. For .NET 3.5 the operation is implemented as a pair of methods using the standard naming convention of BeginRunTask and EndRunTask.
Namespace: Amazon.ECS
Assembly: AWSSDK.ECS.dll
Version: 3.x.y.z
public virtual Task<RunTaskResponse> RunTaskAsync( RunTaskRequest request, CancellationToken cancellationToken )
Container for the necessary parameters to execute the RunTask service method.
A cancellation token that can be used by other objects or threads to receive notice of cancellation.
Exception | Condition |
---|---|
AccessDeniedException | You don't have authorization to perform the requested action. |
BlockedException | Your Amazon Web Services account was blocked. For more information, contact Amazon Web Services Support. |
ClientException | These errors are usually caused by a client action. This client action might be using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Or, it might be specifying an identifier that isn't valid. |
ClusterNotFoundException | The specified cluster wasn't found. You can view your available clusters with ListClusters. Amazon ECS clusters are Region specific. |
ConflictException | The request could not be processed because of conflict in the current state of the resource. |
InvalidParameterException | The specified parameter isn't valid. Review the available parameters for the API request. For more information about service event errors, see Amazon ECS service event messages. |
PlatformTaskDefinitionIncompatibilityException | The specified platform version doesn't satisfy the required capabilities of the task definition. |
PlatformUnknownException | The specified platform version doesn't exist. |
ServerException | These errors are usually caused by a server issue. |
UnsupportedFeatureException | The specified task isn't supported in this Region. |
.NET:
Supported in: 8.0 and newer, Core 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.5 and newer