This course has been updated! We now recommend you take the AWS for Front-End Engineers (ft. S3, Cloudfront & Route 53) course.

Check out a free preview of the full Zero to Production Node.js on Amazon Web Services course:
The "NPM Scripts & Elastic Beanstalk" Lesson is part of the full, Zero to Production Node.js on Amazon Web Services course featured in this preview video. Here's what you'd learn in this lesson:

The deployment environment, which Kevin will be covering later in this course, is Elastic Beanstalk. The NPM scripts that are used by Elastic Beanstalk are start, prestart, and poststart. These scripts start the Node process and run any necessary commands before and after the process has started.

Get Unlimited Access Now

Transcript from the "NPM Scripts & Elastic Beanstalk" Lesson

[00:00:00]
>> [MUSIC]

[00:00:03]
>> Kevin Whinnery: I mentioned this before but the NPM scripts have a special relationship with Elastic Beanstalk which is gonna be our deployment environment here this afternoon. The three NPM scripts that Elastic Beanstalk cares about is NPM start, which is going to be the command that's run to actually start up the web process that's gonna serve requests on your EC2 instance.

[00:00:30] Prestart, which is the command to run prior to the start. And poststart, which as you might imagine, is the command run after the start command. So wherever we have an NPM start is going to be the way that Elastic Beanstalk launches our node process. In our example, we're just launching our server process with the node command.

[00:00:53] But you might imagine we could do other things like start it with a process manager like PM2 or Nodemon or Forever or something like that rather than just using node directly. So this is the opportunity we have to kind of configure how our node process is run.