ECS Services
Uptime Scheduler stops ECS services by scaling the desired count to zero, and starts them by restoring the previous desired count. The service definition and task definition are preserved.
Supported states
| State | Meaning |
|---|---|
running | Service has tasks running (desiredCount > 0) |
stopped | Service is scaled to zero (desiredCount = 0) |
draining | Tasks are being drained |
How scheduling works
- At schedule start time — the service’s
desiredCountis restored to the value saved before the last stop. - At schedule end time — the current
desiredCountis saved to DynamoDB, then set to0. Running tasks are drained according to the service’sderegistrationDelay.
The scheduler monitors the service status and waits for tasks to drain before marking the stop as complete.
Tag location
Tags are applied to the ECS Service (not the task definition or cluster).
AWS Console
Navigate to the service → Tags tab.
AWS CLI
aws ecs tag-resource \ --resource-arn arn:aws:ecs:eu-west-2:123456789012:service/my-cluster/my-service \ --tags key=uptime:schedule,value="9-17 mon-fri"Tag example
uptime:schedule = 9-17 mon-friuptime:env = stagingDesired count restoration
The desired count saved before the last stop is used on restart. If you scale the service manually while it is running, Uptime Scheduler will save and restore whatever count the service had at stop time.
For example:
- Service starts with
desiredCount = 2 - You manually scale to
desiredCount = 4 - Uptime Scheduler stops the service at end of day, saving
desiredCount = 4 - On next start, service is restored to
desiredCount = 4
Supported launch types
- Fargate — fully supported
- EC2 launch type — fully supported (EC2 capacity must be available)
- External — not supported
Placement strategies
Placement strategies and constraints on the service are not affected by scale-to-zero operations.