Skip to main content
Platforms

AWS ECS

Run Rivet workers on Amazon ECS with Fargate.

Workers run in runner mode here: the task opens a connection out to the control plane on startup. It needs no load balancer and no public address.

Requirements

  • An AWS account with ECS and Fargate available
  • A container registry, typically ECR
  • A control plane, either Rivet Cloud or your own

Steps

A reference deployment is published as the AWS ECS template, with two paths:

Whichever path you take, two things in the task definition are specific to Rivet:

  • stopTimeout. Actors drain for up to 30 minutes. Fargate caps stopTimeout at 120 seconds, so a worker cannot fully drain within a single task stop. Plan rollouts so old tasks overlap new ones, and keep minimumHealthyPercent at 100 so capacity is added before it is removed.
  • The endpoint variables. Set RIVET_ENDPOINT and RIVET_PUBLIC_ENDPOINT through the secrets block, backed by Secrets Manager, rather than plain environment entries. Both values are described in Workers.

Verify

aws ecs describe-services --cluster <cluster> --services <service> \
  --query 'services[0].runningCount'

Once tasks are running they appear under Runners in the dashboard. Nothing needs registering.

Autoscaling

Runner-mode tasks are interchangeable, so ECS Service Auto Scaling can drive the desired count. Use target tracking on ECSServiceAverageCPUUtilization at 60%, with a minimum of two tasks.

Scale-in is the caveat. It is bound by the same 120 second stopTimeout cap, so actors on a removed task are cut off rather than drained. Set a long scale-in cooldown, or leave the desired count fixed and change capacity at deploy time instead.

Next steps