[chef] Re: Down scaling instances in AWS - how to run code on instance termination?


Chronological Thread 
  • From: Michel Blankleder < >
  • To:
  • Subject: [chef] Re: Down scaling instances in AWS - how to run code on instance termination?
  • Date: Thu, 19 Feb 2015 11:26:28 -0200

Hi,
Basically you need to create a script that wraps the knife delete command.
Put it on the /etc/init.d/ and then link it to the /etc/rc0.d/
Hope it helps
Michel

On Thu, Feb 19, 2015 at 10:35 AM, Rafał Radecki < " target="_blank"> > wrote:
Hi All :)

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!

BR,
Rafal.




Archive powered by MHonArc 2.6.16.

§