Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am in need of knowing when an instance is supposed to be shutdown by the autoscale, as I want the instances to register themselves and deregister themselves from a given service.
I know that the autoscale can start/stop any instance any time so I need the instances to be notified of when are they going to be shutdown.

Is there anyway of achieving this behaviour?

share|improve this question

I haven't found anyway to do this whole process through the CLI as it seems that Amazon hasn't added the SQS service to its api tools for linux. However, yes it is possible to do and its really not too difficult.

  1. Log into the AWS console
  2. Click the SNS tab

    • Create a new topic
    • Copy the Topic ARN example: arn:aws:sns:us-east-1:############:mytopic
    • Create a new subscription for whatever protocol you want (HTTP, Email, SMS, SQS)
  3. Using the command line tools or some other interface run the command below. After running this command all notifications will be sent using the defined protocol.

as-put-notification-configuration <auto-scaling-group> -t <topic-arn> -n autoscaling:EC2_INSTANCE_LAUNCH,autoscaling:EC2_INSTANCE_TERMINATE

I recommend sending them to SQS first then to your application. Its a little bit safer to have the messages stored in a queue and read from them. The only problem with SQS is its a little more complicated to get going, but there's plenty of documentation about SQS and a good API in almost any language you're using.

share|improve this answer
I know this is very old but perhaps someone else is looking for an answer. – bwight Feb 27 '12 at 14:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.