Recently I found another strange thing in EC2 – if I use “shutdown now” on ec2 instance for AWS this node will be still alive and in marked as “running” in ec2-describe-instances host list. For those who want to have simple way to shutdown ec2 instances from script I recommend to use this code ( I use it in our Convergence – Data-Aware routing on EC2 project ) :

ec2-describe-instances | grep `hostname` | awk "{ print \"ec2-terminate-instances \" \$2; }" >> /root/tools/stop_it.sh

You may just run stop_it.sh or schedule it via at

at -f /root/tools/stop_it.sh "now + $TIMEOUT minutes"

just not forget to replace $TIMEOUT with something usefull 🙂

Leave a Reply