Reputation: 17745
I'm using AWS javascript sdk to build a AWS lambda (canary template). I'm using this in order to reboot some instances at a specified interval (everyday at a certain time).
I'm restarting two instances of the same AMI. Below are my questions:
I hope the title is descriptive enough. If it's not feel free to edit it.
Upvotes: 2
Views: 1658
Reputation: 8401
I am assuming you are using the AWS Javascript sdk
1: The aws node sdk is asynchronous in nature and would return immediately after the reboot command is submitted. You should introduce a wait. I would suggest the describe instance status API to wait, rather than a fixed interval wait.
2: You will not have four instances, as soon as you stop the instance, the asg will terminate the instance and create a new one.
Here is the link to AWS SDK documentation: http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/EC2.html#rebootInstances-property
Upvotes: 2