Skip to main content

Run Amazon ECS Task

Run a task definition as an Amazon ECS task on AWS Fargate and wait for it to stop.

Category: Other

How it works

Run Amazon ECS task definition '<<TaskDefinition>>'

To use this activity within the API, use an ActivityCode of RUN-ECS-TASK.

Example JSON​

An example of what the Task Config would look like for a task using this activity. Some of these variables would be set at the group level to avoid duplication between tasks.

{
"TaskDefinition": ""
}

Variable Reference​

The following variables are supported:

  • AssignPublicIp (Optional) - ENABLED gives the task a public IP, which it needs in a public subnet to reach the internet; DISABLED suits a private subnet. Leave empty to use this environment's setting. See help for using a different value in each environment.

  • Cluster (Optional) - Name or ARN of the ECS cluster to run the task on. Leave empty to use this environment's default cluster. See help for using a different cluster in each environment.

  • Command (Optional) - Overrides the container's command, as a JSON array e.g. ["python", "run.py"] or a comma-separated list. Leave empty to run the image's own command.

  • ContainerName (Optional) - The name of the container to execute

  • Cpu (Optional) - Overrides the task's CPU, in CPU units (1024 is 1 vCPU). Leave empty to keep the task definition's size.

  • Environment (Optional) - Environment variables to set on the container, as JSON e.g. { "NAME": "value" }.

  • IsFederated (Optional) - Makes task available to other Insight Factories within this organisation.

  • Links (Optional)

  • MaximumNumberOfAttemptsAllowed (Optional) - The total number of times the running of this Task can be attempted.

  • MaximumRunTimeHours (Optional) - The maximum number of hours a task run is expected to take. If a run exceeds this duration it will be flagged as stuck.

  • Memory (Optional) - Overrides the task's memory, in MiB, e.g. 2048. It must be a size Fargate allows for the task's CPU. Leave empty to keep the task definition's size.

  • MinutesToWaitBeforeNextAttempt (Optional) - If a Task run fails, the number of minutes to wait before re-attempting the Task.

  • SecurityGroups (Optional) - Comma-separated IDs of the security groups to attach to the task, e.g. sg-0abc1234. They must be in the same VPC as the subnets. Leave empty to use this environment's default security groups. See help for using different ones in each environment.

  • Subnets (Optional) - Comma-separated IDs of the subnets to run the task in, e.g. subnet-0abc1234,subnet-0def5678. Leave empty to use this environment's default subnets. See help for using different ones in each environment.

  • TaskDefinition (Required) - Family, family:revision or ARN of the ECS task definition to run on Fargate. A family on its own runs its latest active revision.