ECS Run Task
Type: DEVRAMPS:ECS:RUN_TASK
Category: deploy
Version: 1.0.0
Description
Run a one-off Fargate task and wait for it to complete.
Runs a standalone Amazon ECS Fargate task as part of a deployment pipeline. Launches the task using a specified task definition, polls for completion, and streams container logs from CloudWatch into the deployment log in near-real-time. Fails the step if any essential container exits with a non-zero exit code. Common use cases include database migrations, smoke tests, cache warming, and seed scripts.
Parameters
Required Parameters
| Parameter | Type | Description |
|---|---|---|
cluster_name | string | The name of the ECS cluster to run the task on. |
task_definition | string | The task definition family name or full ARN (with optional revision) to run. |
subnets | array<string> | List of subnet IDs for the task's network configuration. |
security_groups | array<string> | List of security group IDs for the task. |
Optional Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
account_id | string | - | The AWS account ID where the ECS cluster is located. Defaults to stage account. |
region | string | - | The AWS region of the ECS cluster. Defaults to stage region. |
container_overrides | array<object> | - | Per-container overrides for command and environment variables. |
timeout | integer | 60 | Maximum time in minutes to wait for the task to complete. |
assign_public_ip | boolean | false | Whether to assign a public IP to the task. Defaults to false. |
Example Usage
- type: DEVRAMPS:ECS:RUN_TASK
name: Run Database Migration
params:
cluster_name: my-cluster
task_definition: my-app-migration
subnets:
- subnet-abc123
- subnet-def456
security_groups:
- sg-xyz789
container_overrides:
- container_name: migration
command: ["npm", "run", "migrate"]
environment:
- name: DATABASE_URL
value: "${{ secrets.DATABASE_URL }}"
timeout: 30