Skip to main content
This guide shows how to deploy a simple Node.js web application to AWS Elastic Beanstalk. Elastic Beanstalk automates environment provisioning (EC2 instances, load balancers, Auto Scaling groups, IAM roles, and more) so you can concentrate on your application code and deployment workflow. The sample app in this demo is a minimal web server that returns a static page with a message such as “Elastic Beanstalk demo v1” or “v2”. The app listens on port 3000; the Application Load Balancer (ALB) receives HTTP traffic on port 80 and forwards it to the application on port 3000. Prerequisites Recommended Node.js app basics:
  • Ensure package.json includes a start script that launches your server, e.g. "start": "node index.js".
  • Have your server listen on port 3000 (or the port your EB configuration expects).

1 — Create an Elastic Beanstalk application and environment

  1. In the AWS Console, search for Elastic Beanstalk.
  2. Create a new application (example name: nodejs-app) and optionally add a description and tags.
  3. Create a new environment. For this demo select:
    • Environment tier: Web server
    • Platform: Node.js (choose the version matching your app)
Provide an environment name (example: environment-prod) and select the Node.js platform version that matches your runtime.
A screenshot of the AWS Elastic Beanstalk "Configure environment" console page. It shows environment tier options (Web server selected) and application/environment information with the application name "nodejs-app" and environment name "Nodejs-app-env."

2 — Prepare and upload your application bundle (zip)

Elastic Beanstalk expects an application source bundle as a zip file. Include all application files, e.g. package.json, index.js, public/ or views/, and any static assets. Common packaging methods:
  • macOS / Linux:
  • Windows: right-click the project folder and choose an archive/zip option to create eb-demo-v1.zip.
A screenshot of a Windows desktop showing overlapping File Explorer windows with a project folder selected (files like node_modules, package.json visible). A file-archiving dialog (Archive name and parameters) is open in the foreground.
In the Elastic Beanstalk Create environment wizard select “Upload your code” and choose the zip you created. Optionally choose a deployment preset (e.g., single instance for testing or high-availability for production).
Screenshot of the AWS Elastic Beanstalk "Create environment" page with "Upload your code" selected, a local file named "eb-demo-v1.zip" chosen, and configuration presets showing "Single instance (free tier eligible)". The bottom right shows Cancel and Next buttons.
Give the uploaded application version a label such as 1.0.0 before continuing.

3 — Service role, instance profile, and key pair

Elastic Beanstalk requires an IAM service role to operate. If you don’t have one, choose “Create and use new service role” to let Beanstalk provision it automatically. Also select an EC2 key pair if you need SSH access to the instances for debugging.
A screenshot of the AWS Elastic Beanstalk "Configure service access" console. It shows fields to choose a service role, EC2 key pair, and EC2 instance profile, with navigation steps on the left and Next/Skip buttons at the bottom.

4 — Networking and subnets

Choose the VPC and subnets where the environment will be deployed. Typical pattern:
  • ALB in public subnets (internet-facing)
  • EC2 application instances in private subnets
If your app needs a database, enable RDS here and place it in private subnets. For this demo, database integration is disabled.
A screenshot of the AWS Elastic Beanstalk console showing the Database configuration panel with a list of database subnets (us-east-1a and us-east-1b) and their CIDR ranges. The page also shows options to enable a database and restore a snapshot.

5 — Instance volumes and monitoring

Adjust root volume size, IOPS, and enable CloudWatch monitoring if required. Defaults are sufficient for small demos, but increase disk and monitoring for production workloads.
A screenshot of the AWS Elastic Beanstalk console showing the "Configure instance traffic and scaling" page. It displays root volume (boot device) settings (size, IOPS, throughput) and Amazon CloudWatch monitoring options.

6 — Security groups and Auto Scaling

Attach security groups to the EC2 instances and configure Auto Scaling settings. For load-balanced environments, set a minimum and maximum instance count (e.g., min 1, max 4) and define scaling policies based on CPU/load metrics.
A screenshot of the AWS Elastic Beanstalk console showing EC2 security groups with the "default" group selected. The lower section shows Capacity/Auto scaling group settings with instances configured (Min 1, Max 4).

7 — Architecture, instance types, and AMI

Choose instance architecture, instance types (for example, t3.micro, t3.small), and the AMI. Elastic Beanstalk typically uses Amazon Linux 2 for the Node.js platform — suitable for most use cases.
A screenshot of the AWS Elastic Beanstalk "Create environment" configuration page showing processor architecture options (x86_64 selected), chosen instance types (t3.micro and t3.small), an AMI ID field, and scaling/availability zone settings. The page also displays scaling cooldown and other scaling trigger options.

8 — Load balancer settings

For internet-facing apps, place the ALB in public subnets. Configure listeners: ALB listens on port 80 and forwards to the instance port where your app runs (port 3000 in this demo). Set the target process (commonly default) mapped to the application process listening on port 3000.
A screenshot of the AWS console (Elastic Beanstalk) showing "Load balancer network settings" with Visibility set to Public and a selectable table of load balancer subnets (us-east-1a/us-east-1b) and their CIDRs. The page also shows a scale-down increment field and the start of the Load Balancer Type section.

9 — Monitoring, updates, and deployments

Elastic Beanstalk supports multiple deployment policies. Choose the one that fits your availability needs: For this demo, use a rolling deployment and configure batch size and update behavior.
A screenshot of the AWS Elastic Beanstalk web console showing the "Configure updates, monitoring, and logging" page with health reporting and CloudWatch custom metrics options. A left sidebar lists setup steps (Configure environment, service access, networking, scaling, etc.).
A screenshot of the AWS Elastic Beanstalk console showing the "Rolling updates and deployments" settings, with Deployment policy set to "Rolling" and batch size set to 30% (percentage) and rolling update type "Deactivated."
Rolling deployments reduce downtime by updating instances in batches. If your environment has minimal capacity, ensure the batch size is small enough to keep at least one healthy instance serving traffic.

10 — Review and create environment

Review all configuration settings (service role, networking, scaling, load balancer, etc.) and create the environment. Elastic Beanstalk will provision resources and deploy your application version. This may take several minutes.
A screenshot of the AWS Elastic Beanstalk console on the "Review" page showing environment information (Application name: nodejs-app, Environment name: Nodejs-app-env-prod, Platform: Node.js 18 on Amazon Linux). Below are sections for configuring service access and setting up networking, database, and tags.
Creating an environment typically takes several minutes. Monitor the environment health in the Elastic Beanstalk console; green health indicates the environment is serving traffic successfully.

11 — Verify the deployed environment and AWS resources

When the environment status is healthy (green), open the environment URL from the Elastic Beanstalk console to confirm the app is running. Check the following resources in the EC2 and other AWS consoles:
  • Instances — EC2 instances created for the environment and the running application.
  • Load Balancers — ALB created with listeners forwarding port 80 to target port 3000.
  • Target Groups — targets (instances) registered on port 3000.
  • Auto Scaling groups — manages instance count for the environment.
You should be able to browse the environment URL and see your app’s page.

12 — Update and redeploy your application

To deploy a new version:
  1. Update application files (for example, change the page header to indicate v2).
  2. Create a new zip (e.g., eb-demo-v2.zip) with the updated content.
  3. In the Elastic Beanstalk environment page click Upload and Deploy, select the new zip, provide a version label (for example, 1.0.1), choose the deployment policy (rolling recommended), and deploy.
Example index.html for a v2 update:
Example minimal index.js server (ensure package.json uses "start": "node index.js"):
Verify locally before creating the zip:
If your environment only has a single instance, rolling updates will replace that instance in-place. After deployment finishes the environment should show the new version label (e.g., 1.0.1) and maintain healthy status.
A screenshot of the AWS Elastic Beanstalk console for the Nodejs-app-env-prod environment, showing green health and green success banners for recent deployments. The Platform panel shows Node.js 18 on Amazon Linux and there are controls to upload and deploy a new version.
Open the environment URL to confirm the updated page displays (for example, the header reads “Elastic Beanstalk demo v2”).
A browser screenshot of a simple webpage with a centered header reading "Elastic BeanStalk demo v2" on a blue banner and a pink strip across the top, above a large pale blue background.
If you choose “All at once” for deployments, all instances receive the new version at the same time — this can cause service interruption for users. Use rolling or rolling with additional batch for safer updates when uptime is important.

Conclusion

You have deployed a Node.js application to AWS Elastic Beanstalk, configured networking, scaling, and monitoring, and performed an application update. Elastic Beanstalk offloads environment management so you can focus on application development and iteration. Links and References

Watch Video