AWS / ChatOps
Idle database alerts in Slack: hibernate unless someone says Keep
A schedule stops a database at night, then starts it again every morning, even if nobody has connected for a month. Detecting that is easy. Deciding to turn it off is not, because the person who knows whether it is still needed is rarely the one looking at the bill.
Ask the team, with a default
A report of idle resources sent to a FinOps owner tends to sit in an inbox. A ticket to every team takes weeks. SnoozeDB asks the question where the team already works, in one Slack channel, and gives it a default answer: if nobody objects within 24 hours, the resource is hibernated.
The default matters. An alert that changes nothing unless someone acts is easy to ignore. An alert that hibernates the resource unless someone acts forces a decision from the people who know, and costs them one click when the answer is "we still need it".
How idle is measured
SnoozeDB reads one CloudWatch metric per resource type, in hourly points, over the organization's idle window: 7 days by default, anything from 1 to 30. A resource is idle when no hour in the window reaches the threshold.
| Resource | Metric | Active from |
|---|---|---|
| RDS database | DatabaseConnections (maximum) | 1 connection |
| Redshift cluster | DatabaseConnections (maximum) | 1 connection |
| EC2 instance | CPUUtilization (average) | 5% CPU |
| EKS cluster | Container Insights node_cpu_utilization | 5% CPU |
| ECS cluster | CPUUtilization (average) | 5% CPU |
Databases are judged on connections rather than CPU, because an unused database still burns some CPU on background work. If CloudWatch cannot be read, no alert is sent. The article on finding idle databases with CloudWatch explains these choices in detail.
Only resources that SnoozeDB manages on an enabled schedule, and that are running when the check happens, can get an alert. Locked, excluded and production-protected resources never do.
The alert and the Keep button
When a resource is idle for the whole window, SnoozeDB posts one message in the organization's allowed channel:
💤 staging-db (RDS, eu-west-1) has had no CloudWatch activity for 7 days.
SnoozeDB will hibernate it at Dec 5, 10:00 unless someone presses Keep.
[ Keep ]Anyone who can post in that channel can press Keep, without a SnoozeDB account. Keep does one thing: it pauses inactivity checks on that resource for 7 days. It does not start or stop anything, and it does not change the schedule, locks or triage. After 7 days, the resource is checked again; if it is still idle, a new alert follows.
The message is updated in place to say who pressed Keep and when checks resume. The audit log records the Slack user and team as the actor. Each resource has at most one open alert at a time.
What happens after 24 hours
If nobody presses Keep, SnoozeDB checks again before it acts. Detection and alerts must still be on, the resource must still be eligible and running, and CloudWatch must show no activity since the alert was posted. If anyone used the resource in the meantime, the hibernation is called off and the message says so.
Otherwise SnoozeDB hibernates the resource the same way a schedule would: it stops an RDS database or an EC2 instance, pauses a Redshift cluster, and puts an EKS or ECS cluster to sleep. A Redshift cluster that started sharing data with other clusters is locked instead of paused. Any failure cancels the hibernation rather than retrying it. The alert is replaced by a short message saying the resource was hibernated.
Why the schedule does not wake it up
Without a special rule, the hibernation would last one night. The schedule would see a stopped resource during working hours and start it again the next morning, and the alert would have achieved nothing.
So SnoozeDB marks the resource as hibernated for inactivity. While that mark is set, the schedule does not start it, though scheduled stops still apply. The mark is cleared as soon as someone starts the resource on purpose:
- RDS databases and Redshift clusters: a start from Slack, or a start in AWS that the next sync sees.
- EC2 instances: a start in AWS that the next sync sees.
- EKS and ECS clusters: Wake in the SnoozeDB dashboard.
After that, the normal schedule applies again. Someone who needs the resource has a clear way back, and a resource nobody needs stays off. A Slack start works as described in how to start an AWS database from Slack.
Turning it on
- An owner or admin connects Slack and chooses the allowed channel. Alerts cannot be enabled without one.
- In Settings, General, turn on Detect idle resources and set the idle window.
- In Settings, Slack, turn on Send hibernation alerts and choose the resource types: RDS by default, plus Redshift, EC2, EKS or ECS. EC2 needs a paid plan.
- The AWS account needs the Activity metrics module, which grants
cloudwatch:GetMetricData. Redshift also needs the Redshift scheduling module.
Start with RDS in one development account and a long idle window. Once the team is used to answering alerts, add other types or shorten the window. The Slack integration guide covers each setting.