Automatically delete instance when it gets removed from cluster

Hey guys, I have a situation where sometimes an instance might get deregistered from rancher, but the instance itself is still floating around. Is there a good automated way for that instance to detect that it’s not connected to the cluster anymore and shut down?

I’m using an ASG in aws for my client nodes, and occasionally for whatever reason a node will disconnect from the cluster. After 5 minutes rancher will automatically remove this node, but the ASG is does not know that the instance is now unhealthy!