This container reads sqs messages to determine if an instance in AWS was in the process of being terminated. If it is, this service will deactivate and delete the host from Rancher.
Original Dockerhub Repo: greensheep/rancher-delete-host
Original Github Repo: https://github.com/eploko/rancher-asg-host-unregisterer
Redapt Repo (This Image): https://github.com/redapt/rancher-asg-host-lifecycle
This docker image is based on the original github repo, but has some changes to complete the lifecycle hooks using instance ids instead of tokens. I found the token method to be unreliable.
This container takes several environment variables:
The queue should be setup to receive messages from the lifecycle hook. The host this container runs on should have proper IAM roles to be able to read ec2 instances, read/write sqs messages, and respond to lifecycle events with actions.
Host Labels: The HOSTID Rancher label is required, and should match the ec2 instance id. This id is used to perform the host lookup, and removal. ex: "i-123asd98"