AWS ECS
Run Rivet nodes on Amazon ECS with Fargate.
Your task runs as a node: it opens a connection out to the control plane on startup. It needs no load balancer and no public address.
Requirements
A namespace and a node pool created with PUT /pools/{pool} (see Nodes & Node Pools). In local development, RivetKit creates the default pool for you.
- An AWS account with ECS and Fargate available
- A container registry, typically ECR
- A running control plane
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. Each Rivet Actor gets up to 15 seconds to save its state when a task stops. SetstopTimeoutto 60 seconds. Plan rollouts so old tasks overlap new ones, and keepminimumHealthyPercentat 100 so capacity is added before it is removed.- The endpoint variable. Set
RIVET_ENDPOINTthrough thesecretsblock, backed by Secrets Manager, rather than a plainenvironmententry. The value is described in Deploy Nodes.
Verify
aws ecs describe-services --cluster <cluster> --services <service> \
--query 'services[0].runningCount'
Once tasks are running they serve Rivet Actors.
Autoscaling
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 stops tasks the same way, so Rivet Actors on a removed task sleep and wake on another task. Set a long scale-in cooldown, or leave the desired count fixed and change capacity at deploy time instead.