Easy Steps to Launch Your Node.js Application on AWS
Table of contents
Testing on a Local System
Step 1: Clone the application to your local system
Step 2: Create an environment variables file named .env
and specify the variables
Step 3: Install NPM packages
npm install
Step 4: Run the application on your local system
npm run start
Deploying on an AWS EC2 Instance
Now that the application is working well on your local system, it's time to deploy it on an AWS EC2 instance.
Step 1: Create an IAM user and assign a specific role to that user.
Important: We are using a simple password here, but when working in an organization, it's highly recommended to use a secure password.
Step 2: Login as an IAM User using the credentials provided while creating the user.
Step 3: Create EC2 instance
Step 4: Connect to this EC2 instance.
Step 5: Updating the outdated packaged and dependencies
sudo apt-get update
Step 6: install git on you install, to check where its already installed or not, type this command
git --version
if the git is installed on your ec2 instance then it will show the version of the git.
Step 7: Configure Node.js and npm
- Guide by DigitalOcean
Step 8: Install npm
sudo apt install npm
Check npm —version, to see if its installed or not.
Step 9: Clone your application from git to the server using git clone <url> command. Cloned application on the server.
Step 10: Setting up Environment Variables file, what I have done on local machine
Step 11: Install NPM
npm install
Step 12: Run the application on local system
npm run start
Step 13: Update the Security Group of the EC2 instance to open port 3000, allowing access to the application running on that port.
Step 14: Copy the public IP address of the EC2 instance and the port number where the application is running. Then, try to access the application.
Subscribe to my newsletter
Read articles from Harsh Soni directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Harsh Soni
Harsh Soni
👋 Hello! I'm Harsh, a DevOps enthusiast driven by a passion for continuous learning and innovation. With hands-on experience across cloud platforms, infrastructure tools, and programming languages, I'm committed to creating scalable, automated, and efficient solutions. Let’s connect, share knowledge, and build amazing things together! SKILLS: 🔹Languages & Runtimes: Python, C#, Shell Scripting, YAML 🔹Cloud Expertise: AWS (proficient in EC2, ELB, EBS, S3, VPC, Route53, SES, SNS, CloudFormation, CloudWatch) 🔹Infrastructure & DevOps Tools: Docker, Terraform, AWS CloudFormation 🔹Development & CI/CD: Linux, Git, GitHub Actions, Jenkins, Jira, GitLab (beginner), AWS DevOps 🔹Web Development: HTML, CSS, Bootstrap, .NET, Python, SQL Why Connect with Me? I'm a detail-oriented professional with strong communication skills, always ready to tackle complex problems with a positive mindset. Whether you’re here to network or explore potential collaborations, feel free to reach out. Let’s grow together in the DevOps journey! 📧 Contact Me: harshsoni6011@gmail.com