Skip to main content

Command Palette

Search for a command to run...

Deploying and Exposing a NodeJS Application to the External World with AWS EC2

Updated
โ€ข3 min read
Deploying and Exposing a NodeJS Application to the External World with AWS EC2
P

๐Ÿ‘‹ Hello! I'm passionate about DevOps and have over 1+ years of experience in the field. I'm proficient in a variety of cutting-edge technologies and always motivated to expand my knowledge and skills. Let's connect and grow together!

SKILLS:

๐Ÿ”น Languages & Runtimes: Python, Shell Scripting, HCL, YAML ๐Ÿ”น Cloud Technologies: AWS, Microsoft Azure, GCP ๐Ÿ”น Infrastructure Tools: Docker, Terraform, AWS CloudFormation ๐Ÿ”น Other Tools: Linux, Git and GitHub Actions, Jenkins, Jira, GitLab (beginner), Docker, AWS DevOps ๐Ÿ”น Web Development: HTML, CSS, Bootstrap, Python, SQL

Job & Responsibilities:

๐Ÿš€ Improved development efficiency by implementing CI/CD pipelines, resulting in a 30% reduction in deployment time on the test server. ๐Ÿ”’ Strengthened deployment and testing reliability by utilizing Docker containers and optimizing Dockerfile, reducing development issues on the test server by 20%. โš™๏ธ Automated S3 bucket log creation with Shell scripting, eliminating 100% of manual search and saving 2 hours per week. ๐Ÿ“… Scheduled EC2 instance start/stop using Lambda functions and Event Bridge, leading to a 25% decrease in infrastructure costs. ๐Ÿ”ง Utilized AWS, Linux, Python, Docker, Shell scripting, Terraform, Jenkins Pipelines, and automation to streamline workflows and improve overall system performance.

I'm very detail-oriented and possess strong written and verbal communication skills. As a high performer with a possibility mindset, I strive to solve problems using efficient approaches.

Let's Connect & Grow:

If you find my profile suitable for the role you are searching for, please feel free to reach out to me at sumanprasad9766@gmail.com.

๐Ÿ“ Introduction:

Hi Everyone, welcome to Day-12 of our learning series. In this session, we will cover how to deploy and expose a NodeJS application to the external world using AWS EC2. We will provide a live example and the source code is available on our GitHub repository.

๐Ÿ”น Session Content:

  1. Creating an IAM User and Login: The first step is to create an IAM (Identity and Access Management) user and login to AWS. IAM allows you to manage users and their access to AWS services.

  2. Creating an EC2 Instance: We will then cover how to create an EC2 instance. EC2 is a virtual server in the cloud and it is essential to have good practices when creating instances. We will discuss some of these practices.

  3. Accessing the EC2 Instance: Once the instance is created, we will learn how to access it through the command line interface or a web browser.

  4. Deploying an Application on AWS EC2: Next, we will cover how to deploy a NodeJS application on AWS EC2. We will provide step-by-step instructions and discuss best practices.

  5. Exposing the Application to the Outside World: After deploying the application, we will demonstrate how to expose it to the outside world. This will allow users to access the application from anywhere with an internet connection.

  6. Accessing the Application Deployed on AWS from Your Laptop: Finally, we will show you how to access the application deployed on AWS from your laptop.

๐Ÿ”นSummary:

In this session, we covered the process of deploying and exposing a NodeJS application to the external world using AWS EC2. We discussed the steps involved in creating an IAM user, creating an EC2 instance, accessing it, deploying an application, and exposing it to the outside world. We hope this session was helpful and informative for you. You can find the source code on our GitHub repository for further reference. Thank you for attending this session.

๐Ÿ“ Steps to follow along:

๐Ÿ”น Deploying a Node Js Application on AWS EC2

โšœTesting the project locally

  1. Clone this project
git clone https://github.com/verma-kunal/AWS-Session.git
  1. Setup the following environment variables - (.env) file
DOMAIN= ""
PORT=3000
STATIC_DIR="./client"

PUBLISHABLE_KEY=""
SECRET_KEY=""
  1. Initialise and start the project
npm install
npm run start

โšœ Set up an AWS EC2 instance

  1. Create an IAM user & login to your AWS Console

    • Access Type - Password

    • Permissions - Admin

  2. Create an EC2 instance

    • Select an OS image - Ubuntu

    • Create a new key pair & download .pem file

    • Instance type - t2.micro

  3. Connecting to the instance using ssh

ssh -i instance.pem ubunutu@<IP_ADDRESS>

โšœ Configuring Ubuntu on remote VM

  1. Updating the outdated packages and dependencies
sudo apt update
  1. Install Git - Guide by DigitalOcean

  2. Configure Node.js and npm - Guide by DigitalOcean

โšœ Deploying the project on AWS

  1. Clone this project in the remote VM
git clone https://github.com/verma-kunal/AWS-Session.git
  1. Setup the following environment variables - (.env) file
DOMAIN= ""
PORT=3000
STATIC_DIR="./client"

PUBLISHABLE_KEY=""
SECRET_KEY=""

For this project, we'll have to set up an Elastic IP Address for our EC2 & that would be our DOMAIN

  1. Initialise and start the project
npm install
npm run start

NOTE - We will have to edit the inbound rules in the security group of our EC2, in order to allow traffic from our particular port

๐Ÿ“ Resources:

โšœ Follow Prasad Suman Mohan for many such contents:

N

Thanks for the tutorial. I have a question. What is common method to deploy nodejs application into AWS? Can we integrate CodeCommit and CI/CD pipeline?

1
P

Yes, we can deploy using AWS Developer Tools and they really work well...

P

This comprises of Tools like:

Code Commit & GitHub Code Build Code Deploy Code Pipeline Code Artifacts/S3

1

AWS Cloud โ˜

Part 1 of 50

In this Page, I have filtered all the blogs related to AWS Cloud for easy search.

More from this blog

D

DeployToCloud

405 posts

๐Ÿ‘‹ Welcome to my Hashnode blog! I'm a DevOps Engineer with 2+ years of experience. Join ~5k followers and explore 320+ blogs on Python, AWS, Docker, Jenkins, Linux, and more. Let's connect & grow ๐Ÿš€