AWS ECS icon

AWS ECS

Consume the AWS ECS API

Overview

The AWS ECS - Run Task operation node allows you to start a new task on Amazon Elastic Container Service (ECS) using a specified task definition. This is useful for running containerized workloads on demand, such as batch jobs, microservices, or one-off scripts, without needing to manage the underlying infrastructure directly.

Common scenarios:

  • Launching a containerized job in response to an event.
  • Running ad-hoc data processing tasks.
  • Spinning up temporary services for testing or development.

Practical example:
You could use this node in an n8n workflow to automatically run a data transformation task in ECS Fargate whenever a file is uploaded to S3.


Properties

Name Type Meaning
Launch Type options The infrastructure to run your standalone task on. Options: EC2 (on EC2 instances), Fargate (serverless), External (on-premises/VMs).
Cluster string The short name or full ARN of the ECS cluster to run your task on. If not specified, the default cluster is used.
Task Definition string The family and revision (family:revision) or full ARN of the task definition to run. If no revision is specified, the latest ACTIVE revision is used.
Count number The number of instantiations of the specified task to place on your cluster. You can specify up to 10 tasks per call.
Enable ECS Managed Tags boolean Whether to use Amazon ECS managed tags for the task.
Propagate Tags options Specifies whether to propagate tags from the service or task definition to the task. Only available if "Enable ECS Managed Tags" is true.
Network Configuration fixedCollection The network configuration for the task. Required for awsvpc network mode (e.g., Fargate). Includes VPC configuration, subnets, security groups, and public IP assignment options.

Output

The node outputs a json object containing the full response from the AWS ECS runTask API call. The structure includes:

{
  "tasks": [
    {
      "taskArn": "...",
      "clusterArn": "...",
      "taskDefinitionArn": "...",
      "lastStatus": "...",
      "desiredStatus": "...",
      // ... other ECS task fields
    }
    // ... more tasks if count > 1
  ],
  "failures": [
    {
      "arn": "...",
      "reason": "..."
    }
    // ... if any failures occurred
  ]
}
  • tasks: Array of details about each started task.
  • failures: Array of failure objects if any tasks failed to start.

No binary output is produced by this operation.


Dependencies

  • AWS Account with ECS permissions.
  • AWS credentials (access key ID, secret access key, region) must be configured in n8n.
  • The aws-sdk library is used internally.

n8n configuration:
Set up AWS credentials in n8n under "Credentials" as type "AWS".


Troubleshooting

Common issues:

  • Invalid credentials: Ensure your AWS credentials are correct and have permission to run ECS tasks.
  • Missing required parameters: Make sure all required properties (e.g., Task Definition, Count, Network Configuration for Fargate) are provided.
  • Network configuration errors: For Fargate/awsvpc, ensure subnets and security groups are valid and belong to the same VPC.
  • API limits: You can only launch up to 10 tasks per call.

Error messages:

  • "Operation \"...\" not supported!": Check that you selected a valid operation.
  • AWS error messages (e.g., "Cluster not found", "Invalid task definition"): Review the property values and ensure resources exist in your AWS account.

Links and References

Discussion