How To Deploy Sample NodeJS Application With AWS Elastic Beanstalk

AutOpsAutOps
4 min read

Author: Ujwal Pachghare

🤔What Is Elastic Beanstalk?

AWS Elastic Beanstalk is a fully managed service that simplifies the deployment and management of applications in the AWS Cloud.

In simple way AWS Elastic Beanstalk is a powerful tool for deploying and managing web applications in the AWS Cloud.

🤑What Are Key Benefits Of Using Beanstalk?

  • Easy to Use: simply upload your application and Elastic Beanstalk automatically handles the provisioning, load balancing, scaling, and application health monitoring.

  • Support Multiple Languages: Elastic Beanstalk supports applications developed in Go, Java, .NET, Node.js, PHP, Python, and Ruby.

  • Customizable: You can change the configuration as needed.

  • Cost: There is no charge for using Elastic Beanstalk. You pay only for the AWS resources that your application is using.

🚀How To Deploy Application on Elastic Beanstalk?

First, it`s mandatory to have access of AWS management console. If you have an AWS account so you are ready to start the journey of Elastic Beanstalk.

For deep understanding follow this AWS official documentation here📍The following steps will guide through deploying a web application on AWS Elastic Beanstalk. Let`s Start……..

1. Open the Elastic Beanstalk Page

Go to AWS Console → Search for the Elastic Beanstalk → Click on Elastic Beanstalk from dropdown. Great!! Now you will see following page.

2. Create Environment and Deploy our Application

In this demo we will just choose mandatory options to setup an environment for Sample Nodejs Application.

If I sign on the box title with 🔴 that means the full box options, you could leave default. If I sign any option with 🟢means that option is mandatory or you must edit it according to your needs.

🟢Mandatory/ Edit it

🔴Leave Default

🟢We chose Web Server Environment because we are deploying sample web application of python. This option can be used for serving HTTP request for websites, web applications and web APIs

🟢Worker Application this option can be used for creating separate worker environment tier.

🟢Managed Platform means it will be maintained and managed by AWS Elastic Beanstalk automatically.

🟢Platform means in which programming language runtime environment we want to run our application. we can also choose Platform version.

🔴Application Code: here we can upload our app code from local machine or can get from S3 bucket. we are using sample app code which will be managed AWS Elastic Beanstalk.

🔴Presets: here we can choose our instances with deferent configurations or can create our custom.

🟢Use an existing service role means the IAM Role which is already present with all mandatory permissions. If there is now existing role then you can choose Create and use new service role options, it will create new role with all mandatory permissions.

🔴Choose EC2 key pair If you wanna SSh into instance in the future. its not mandatory.

🟢EC2 Instance Profile means a role with use case EC2 and which have all the mandatory permissions. choose existing/default role , in case there is no any existing/default role. you can create role by following demo which is at the last of this blog.⬇️

That`s it, for Sample Application purpose these things are enough. now just click on Skip and review button at the last of the page. after clicking on button, you will be redirected to the following page review all the things and click on Submit button at the last of the page.

✋Wait for 3–4 minutes. after 3–4 minutes you will see Ok health status and domain name of our application. now click on the domain name.

→ After click on domain name you will see following our application page in the browser. Congrats🎉 you have deployed Sample NodeJS application with AWS Elastic Beanstalk.

🧹Cleaning Up

  1. Go to AWS Elastic Beanstalk Console →: Click on Application from left side menu →: Select our Application by checking box → Click on Action menu → Click on Delete Application → you can see following box → type our app name → Click on Delete

❔Elastic Beanstalk FAQs

1. Who should use AWS Elastic Beanstalk?

Those who want to deploy and manage their applications within minutes in the AWS Cloud.

2. Which Operating Systems Does AWS Elastic Beanstalk Use?

AWS Elastic Beanstalk runs on the Amazon Linux AMI and the Windows Server AMI.

3. What Kinds Of Applications Are Supported By Aws Elastic Beanstalk?

AWS Elastic Beanstalk supports Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker, and it is best for web applications. and non-web applications can also be deployed using Elastic Beanstalk.

📌Create IAM Role For EC2 Instance Profile

→ To create an IAM Role for EC2 instance profile selection

  1. Go to IAM console

  2. In the IAM console navigation pane, choose Roles.

  3. Choose Create role.

  4. Under Trusted entity type, choose AWS service.

  5. Under Use case, choose EC2.

  6. Choose Next.

  7. Attach the appropriate managed policies. Scroll in the View instance profile permissions modal window to see the managed policies. The policies are also listed here:

  • AWSElasticBeanstalkWebTier

  • AWSElasticBeanstalkWorkerTier

  • AWSElasticBeanstalkMulticontainerDocker

  1. Choose Next.

  2. Enter a name for the role.

  3. (Optional) Add tags to the role.

  4. Choose Create role.

0
Subscribe to my newsletter

Read articles from AutOps directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

AutOps
AutOps