Apps Development, AWS, Cloud Computing

3 Mins Read

A Guide to Deploy a Node.js Web App on AWS: Part 1

Voiced by Amazon Polly

Introduction

Node.js is a well-known open-source server environment. It’s a platform built on Chrome’s JavaScript runtime environment for easily building fast and scalable network applications.

In this blog, we will deploy a high-availability Node.js Web App using AWS Elastic Beanstalk and Amazon DynamoDB. We will be using a sample app that uses Node.js, Express, and a NoSQL database.

When using AWS Elastic Beanstalk, we can upload our code, and Elastic Beanstalk automatically handles the deployment, auto-scaling to application health monitoring, capacity provisioning, and load balancing.

It automatically scales the app up and down on its specific need using easily adjustable Auto Scaling settings. For fast and flexible NoSQL database service, we will use Amazon DynamoDB, which provides consistent, single-digit millisecond latency at any scale. Amazon DynamoDB is a fully managed cloud database supporting document and key-value store models.

Pioneers in Cloud Consulting & Migration Services

  • Reduced infrastructural costs
  • Accelerated application deployment
Get Started

Architecture Diagram

Architecture Diagram to serve the Node.js app using AWS Elastic Beanstalk & DynamoDB

ad

Step-by-Step Guide

  • Create an AWS account: If you don’t have one already, create an AWS account at https://aws.amazon.com/ and log in.
  • Set up AWS Elastic Beanstalk
    1. Open the Elastic Beanstalk console using the preconfigured link below:
      Elastic Beanstalk Console
    2. For Platform, we need to select the platform and the platform branch that matches the language used by the application.
    3. Then, we need to select the Application code and Sample application.
    4. Choose ‘Review and launch’.
    5. Review the options available, then choose the option you want to use and choose the ‘Create app’ when ready.

Elastic Beanstalk will take about five minutes to create the environment with the following resources:

  • EC2 instance – An Amazon Elastic Compute Cloud (EC2) virtual machine configured to run web apps on our chosen platform.
  • Instance Security Group – EC2 service group is configured to allow inbound traffic on port 80, which lets HTTP traffic from the load balancer reach the EC2 instance running in the web app. So, by default, traffic isn’t allowed on the other ports.
  • Load Balancer – An Elastic Load Balancing load balancer is configured to distribute requests to the application instances. A load balancer also eliminates the need to expose the instance directly to the internet.
  • Load Balancer security group – The load balancer security group is the same as the EC2 security group and does the same task. This resource lets the HTTP traffic from the internet reach the load balancer.
  • Auto Scaling group – An Auto Scaling group is configured and made available to replace an instance if terminated or unavailable.
  • Amazon S3 bucket – A storage location for the source code, logs, or other artifacts created when Elastic Beanstalk is used.
  • Amazon CloudWatch alarms – Amazon CloudWatch alarms set Two alarms that are triggered if the load is too high or too low. When the alarm is triggered, the ‘Auto Scaling group’ scales up or down in response.
  • AWS CloudFormation Stack – CloudFormation is used by Elastic Beanstalk to launch the resources in the environment and propagate configuration changes. These resources are defined in a template that can be viewed in the AWS CloudFormation console
  • Domain Name – The domain name which will route the web app in the form subdomain.region.elasticbeanstalk.com.

Elastic Beanstalk manages all the resources, and when we terminate the environment, it terminates all of the resources it contains.

Note: The Amazon S3 bucket that Elastic Beanstalk creates is shared between environments, and it’s not deleted during the environment termination.

Conclusion

Elastic Beanstalk provisions, underlying infrastructure (e.g., Amazon EC2 instances), and management environment. Elastic Beanstalk benefits and provides many configuration options that make an easily manageable environment.

Check out the blog for Part -2 here.

Making IT Networks Enterprise-ready – Cloud Management Services

  • Accelerated cloud migration
  • End-to-end view of the cloud environment
Get Started

About CloudThat

CloudThat is a leading provider of Cloud Training and Consulting services with a global presence in India, the USA, Asia, Europe, and Africa. Specializing in AWS, Microsoft Azure, GCP, VMware, Databricks, and more, the company serves mid-market and enterprise clients, offering comprehensive expertise in Cloud Migration, Data Platforms, DevOps, IoT, AI/ML, and more.

CloudThat is the first Indian Company to win the prestigious Microsoft Partner 2024 Award and is recognized as a top-tier partner with AWS and Microsoft, including the prestigious ‘Think Big’ partner award from AWS and the Microsoft Superstars FY 2023 award in Asia & India. Having trained 850k+ professionals in 600+ cloud certifications and completed 500+ consulting projects globally, CloudThat is an official AWS Advanced Consulting Partner, Microsoft Gold Partner, AWS Training PartnerAWS Migration PartnerAWS Data and Analytics PartnerAWS DevOps Competency PartnerAWS GenAI Competency PartnerAmazon QuickSight Service Delivery PartnerAmazon EKS Service Delivery Partner AWS Microsoft Workload PartnersAmazon EC2 Service Delivery PartnerAmazon ECS Service Delivery PartnerAWS Glue Service Delivery PartnerAmazon Redshift Service Delivery PartnerAWS Control Tower Service Delivery PartnerAWS WAF Service Delivery PartnerAmazon CloudFront Service Delivery PartnerAmazon OpenSearch Service Delivery PartnerAWS DMS Service Delivery PartnerAWS Systems Manager Service Delivery PartnerAmazon RDS Service Delivery PartnerAWS CloudFormation Service Delivery PartnerAWS ConfigAmazon EMR and many more.

FAQs

1. What is the benefit of hosting an AWS and Elastic Beanstalk application?

ANS: – Elastic Beanstalk provides multiple tools to manage resources, e.g., Monitoring tools, Resource management, and it also provides simple configuration options that make it easy to manage environments. We can upload our code, and Elastic Beanstalk automatically handles the deployment, from capacity provisioning, load balancing, and auto-scaling to application health monitoring. And at the same time, we retain full control over the AWS resources powering our application and can access the underlying resources anytime.

2. Is there a possibility to make my application non-highly available?

ANS: – Yes, we can change the environment type to Single Instance to remove the load balancer and launch the single-AZ database instance, reducing the number of resources needed to run the environment.

WRITTEN BY Guru Bhajan Singh

Guru Bhajan Singh is currently working as a Software Engineer - PHP at CloudThat and has 7+ years of experience in PHP. He holds a Master's degree in Computer Applications and enjoys coding, problem-solving, learning new things, and writing technical blogs.

Share

Comments

    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!