When an EC2 instance in an Auto Scaling Group shuts down, event-driven plumbing kicks in. A lifecycle hook catches the scale-in, fires off an SNS notification, and triggers a Lambda. That Lambda calls the GitHub API to yank the self-hosted runner before the instance dies.
No dangling runners. No manual scripts. Clean exits!