Wednesday, 5 April 2017

AWS Beanstalk Killing a process

I have a node app on AWS Beanstalk which acts like a worker to process some jobs. I want that, somehow I can kill this node process and then restart it again whenever I want.

For eg, let's say I have another app which has a switch for kill/restarting this process. So, I will call some service here to kill or restart the EC2 instance from here.

I went through the AWS Beanstalk Javascript SDK docs and it has one function to restart the app:

restartAppServer(params = {}, callback) ⇒ AWS.Request


/* The following operation restarts application servers on all instances in an environment named my-env: */

 var params = {
  EnvironmentName: "my-env"
 };
 elasticbeanstalk.restartAppServer(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
 });

But I can't find any function in this SDK to kill the app, like killAppServer.

I also found this tutorial to do the same but it looks little complicated and I want to avoid this if there is a simpler solution for that.

So, can anyone tell me how I can kill/stop the Node process in AWS Beanstalk?



via myke_11j

No comments:

Post a Comment