Skip to content

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

StateMeaning
runningService has tasks running (desiredCount > 0)
stoppedService is scaled to zero (desiredCount = 0)
drainingTasks are being drained

How scheduling works

  • At schedule start time — the service’s desiredCount is restored to the value saved before the last stop.
  • At schedule end time — the current desiredCount is saved to DynamoDB, then set to 0. Running tasks are drained according to the service’s deregistrationDelay.

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

Terminal window
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-fri
uptime:env = staging

Desired 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:

  1. Service starts with desiredCount = 2
  2. You manually scale to desiredCount = 4
  3. Uptime Scheduler stops the service at end of day, saving desiredCount = 4
  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.