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.
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
Architecture Diagram
Architecture Diagram to serve the Node.js app using AWS Elastic Beanstalk & DynamoDB
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
- Open the Elastic Beanstalk console using the preconfigured link below:
Elastic Beanstalk Console - For Platform, we need to select the platform and the platform branch that matches the language used by the application.
- Then, we need to select the Application code and Sample application.
- Choose ‘Review and launch’.
- Review the options available, then choose the option you want to use and choose the ‘Create app’ when ready.
- Open the Elastic Beanstalk console using the preconfigured link below:
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
About CloudThat
CloudThat is an official AWS (Amazon Web Services) Advanced Consulting Partner and Training partner and Microsoft Gold Partner, helping people develop knowledge of the cloud and help their businesses aim for higher goals using best in industry cloud computing practices and expertise. We are on a mission to build a robust cloud computing ecosystem by disseminating knowledge on technological intricacies within the cloud space. Our blogs, webinars, case studies, and white papers enable all the stakeholders in the cloud computing sphere.
Drop a query if you have any questions regarding Node.js, Amazon Elastic Beanstalk and I will get back to you quickly.
To get started, go through our Consultancy page and Managed Services Package that is CloudThat’s offerings.
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 6+ 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.
Click to Comment