You might consider using Fog instead of AWS SDK; it’s certainly nicer all-around for cloud stuff. We’ve even got a cookbook we wrote to install it for use during Chef runs: et_fog.
Lead DevOps Engineer
On February 19, 2015 at 10:37:51 AM, Jake Plimack (firstname.lastname@example.org) wrote:
I just let my autoscaling nodes delete themselves as they terminate
On Feb 19, 2015 8:34 AM, “Rafał Radecki” email@example.com wrote:
Thanks for the tips Notification hooks and SQS look very promising
I assume that I would have to use aws-sdk for ruby (https://aws.amazon.com/sdk-for-ruby/) in chef to connect to SQS and read events from it? Are there any problems in using this sdk? Is it stable/current? Are there any available howtos about SQS/aws-sdk/chef integration?
2015-02-19 14:45 GMT+01:00 David Petzel firstname.lastname@example.org:
This is how we handled it as well. We configured our autoscaling groups such that a termination event was sent to SNS, which landed in an SQS queue.
We then had an “admin” node that would wake up every 60 seconds and check the SQS queue for any pending termination notices, and it would then process them by deleting the node and client objects from the Chef server, as well as some internal housekeeping items.
On Thu, Feb 19, 2015 at 8:21 AM, Michael Glenney email@example.com wrote:
In the past I’ve done this with events and have a separate process that receives the events and performs verification of them and, once verified, runs cleanup steps. One of which was deleting the node and client entries from the chef server.
Here’s some info on autoscaling events:
On Feb 19, 2015 5:35 AM, “Rafał Radecki” firstname.lastname@example.org wrote:
I am using chef and autoscaling for aws ec2 instances. Installation of chef and node’s registration process is handled mostly in user data so when an instance is started because of autoscaling rule it properly registers in chef.
When the instance is downscaling I would like to deregister it in chef automatically. My problem is basically: how to run some code when aws terminates an ec2 instance? I already saw some solution based on init scripts run on shutdown but I think it is not the best choice I also found info about terminating:wait functionality (http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/AnalyzingAnAutoScalingInstance.html) and am investigating it now.
Can someone point me in a proper direction?
Thanks for the help!