AWS Auto Stopping
Auto stopping in AWS enables you to spin down EC2 instances, RDS databases, ASGs, and ECS Services. You can do this either by monitoring traffic with an ALB or proxy, or by creating defined schedules of uptime and downtime.
Creating Rules
You can create auto stopping rules in the Harness UI or via IAC with Terraform. The recommended approach is to use IAC to define your resources.
A rule can use both traffic monitoring and schedules to define its stopping behavior.
Ingress Based
ALB
If the application has an existing ALB, or the application is HTTP based, then you can use an ALB to measure the usage of the application for auto stopping.
The flow of an ALB auto stopping rule is as follows:
- Harness shuts down the EC2 instance
- Harness modifies the ALB to point at the created lambda function
- When traffic is received, lambda presents the user with the progress page
- Harness starts up the EC2 instance
- When instance is ready, ALB is modified to send traffic to EC2
- The lambda monitors cloudwatch for activity logs
- When cloudwatch shows no activity, the lambda updates Harness
- Repeat from step 1

Dependencies
You can define a dependency on another auto stopping rule. This will make sure that the dependent rule is online when the rule with the configured dependency is online.
For example, you have a stopping rule for a database configured in Harness. When you create a stopping rule for the application you can specify a dependency on the database rule so that whenever the application is online Harness will ensure that the database is also online.
- Database and application are offline
- Application receives some trigger to come online
- Harness triggers the database to come online, waits the specified amount of time
- Harness triggers the application to come online.

Warming Up Workloads
There is an API available to "warm up" or "cool down" a rule for a specified amount of time. This can be helpful when you have a schedule applied but some developer needs access to an application, or needs to test bringing the workload down.
To call this API the token used must have auto stopping rule view in the Harness account.
Provisioning via Terraform
There exists several examples of configuring and deploying rules in this repository.