Prerequisites to Proceed Further
Valid node application
We will be uploading a Node application to EBS in this demo.
There are other deployment environments also available with EBS, but this course is explicitly focused on a Node application.
If you don't have a Node application available, you can access the following GitHub project:
You can't perform that action at this time. You signed in with another tab or window. You signed out in another tab or…
Valid AWS account
Of course, you need to have a valid AWS account available to code along with this article.
Deploying Applications to Elastic Beanstalk
Lets first look at the application we need to deploy. We have a simple Node project that renders a sample user page. Given below is the
package.json file for the sample project
In the package file specified above, we need to ensure that the
scripts tag contains a
start script. This script will be used to bootstrap the application on the Elastic Beanstalk server. In the sample code, we have configured the start script as
EBS will look for the
scripts and execute the command specified in
start. If the correct script is not specified in the
start tag or if the
start tag is not available, the application deployment will fail.
Adding Configuration to Elastic Beanstalk
First, we need to go to the AWS Management Console,and look for “Elastic Beanstalk.”
Go to the Elastic Beanstalk console
Go to the Elastic Beanstalk service. Then click on the “Get Started” button to get started with the AWS Elastic Beanstalk deployment.
Create a new web application
Once we create a new web application, we need to configure the application. We need to provide the application information and base configuration.
Configuring application information
In the above screen, we need to configure the application configuration, which involves configuring the application name and application tags — but you can skip the application tags information in the configuration.
Next, we need to specify the base configuration for the application.
Configuring base configuration
We need to add the following configuration into the base configuration.
- Add the platform for the application. Our application is working on the Node platform, therefore we need to set the platform as
2. Once the application platform is configured, we need to upload the code for the application.
The ZIP file for the code needs to be uploaded to the configuration. In case you are following my sample application, clone the GitHub repository locally and create a ZIP file for the same. We can then upload this ZIP file.
Note: We need not add the
node_modules folder to the ZIP file.
You can access the ZIP file here.
Upload the ZIP file to the base configuration.
Create application once configured
Now click “Create application” in order to create the application with the code specified in the
sample-node-application ZIP folder.
Once the user clicks on “Create application,” the code is deployed on the EBS server on default port 8080.
In order to deploy the code, EBS deploys an EC2 instance on which the application is executed.
After a while, the application will be deployed and made available.
And, finally, the application is up and running on the URL specified:
Note: The EBS runs the application on the default port 8080; therefore if some other port is configured, the application will fail to run on the browser. Below is the sample port configuration that I used: