{"id":23197242,"url":"https://github.com/sankalpharitash21/nodejs_aws","last_synced_at":"2026-05-19T10:02:10.872Z","repository":{"id":258882189,"uuid":"862151466","full_name":"SankalpHaritash21/NodeJS_AWS","owner":"SankalpHaritash21","description":"Deploying a scalable Node.js app on AWS EC2, configuring security, and using PM2.","archived":false,"fork":false,"pushed_at":"2024-10-21T07:33:49.000Z","size":161,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-21T06:59:02.377Z","etag":null,"topics":["aws","aws-ec2","pm2","security"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SankalpHaritash21.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-24T06:03:44.000Z","updated_at":"2025-01-25T15:55:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"ced5f490-3ce9-4114-b40a-2a6d961b28e3","html_url":"https://github.com/SankalpHaritash21/NodeJS_AWS","commit_stats":null,"previous_names":["sankalpharitash21/nodejs_aws"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SankalpHaritash21/NodeJS_AWS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SankalpHaritash21%2FNodeJS_AWS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SankalpHaritash21%2FNodeJS_AWS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SankalpHaritash21%2FNodeJS_AWS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SankalpHaritash21%2FNodeJS_AWS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SankalpHaritash21","download_url":"https://codeload.github.com/SankalpHaritash21/NodeJS_AWS/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SankalpHaritash21%2FNodeJS_AWS/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276204844,"owners_count":25602738,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-21T02:00:07.055Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","aws-ec2","pm2","security"],"created_at":"2024-12-18T14:29:29.445Z","updated_at":"2025-09-21T06:59:04.754Z","avatar_url":"https://github.com/SankalpHaritash21.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deploying a Node.js Application on AWS EC2 Instance\n\n![NodeJS to AWS](./NodeAws.png)\n\n# Deploying Node.js Application on AWS EC2 Instance\n\nThis guide will walk you through the steps to deploy a Node.js application on an AWS EC2 Linux instance.\n\n## Prerequisites\n\n- An AWS account\n- Basic knowledge of Node.js\n- A Node.js application to deploy\n\n---\n\n## Steps to Deploy the Application\n\n### 1. Login to AWS Console\n\n- Log in to your [AWS account](https://aws.amazon.com/console/).\n- Navigate to the **EC2** service by typing \"EC2\" in the services search bar.\n\n### 2. Launch an EC2 Instance\n\n- Select **Launch Instance**.\n- Name your instance, for example: `nodejs_AWS`.\n- Choose the appropriate AMI (Amazon Machine Image). In this case, select **Ubuntu** or any Linux-based AMI.\n- Configure your instance, select **t2.micro** or as per your needs.\n- In the **Key pair** section, create or choose a key pair to access the instance later.\n\n### 3. Configure Security Group\n\n- Allow **HTTP** access from the internet.\n- Ensure your security group allows **port 3000** (or whatever port your Node.js application uses) for **TCP** traffic.\n\n### 4. Connect to the EC2 Instance\n\nOnce your instance is running:\n\n- Open the terminal and SSH into the instance:\n\n  ```bash\n  ssh -i your-key-file.pem ubuntu@your-ec2-public-ip\n  ```\n\nSwitch to the superuser:\n\n```bash\nsudo su\n```\n\n5. Install Node.js and Git\n\n- Install Git:\n\n```bash\nsudo apt update\n```\n\n```bash\nsudo apt install git\n```\n\n- Install Node.js using Node Version Manager (nvm):\n\n```bash\ncurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash\n```\n\n```bash\nsource ~/.nvm/nvm.sh\n```\n\n```bash\nnvm install 16\n```\n\nVerify the installation:\n\n```bash\nnode -v\ngit --version\n```\n\n6. Clone the Repository\n   Clone your Node.js application from GitHub:\n\n```bash\ngit clone https://github.com/your-username/your-nodejs-repo.git\n```\n\n```bash\ncd your-nodejs-repo\n```\n\n7. Install Dependencies\n   Install the required dependencies:\n\n```bash\nnpm install\n```\n\n8. Start the Application\n   Run the application:\n\n```bash\nnode index.js\n```\n\n#### Your application should now be running. Verify by visiting http://your-ec2-public-ip:3000 in your browser.\n\n9. Configure Security Group for Port 3000\n   If you haven't already configured security groups:\n\nGo to EC2 Dashboard.\n\n- Select your running instance\n- Navigate to Security Groups.\n- Edit Inbound Rules and allow Custom TCP on Port 3000 from Anywhere.\n\n10. Run the Application with PM2\n\nTo keep your application running even after disconnecting from the terminal, install and use PM2:\n\nInstall PM2 globally:\n\n```bash\nnpm install pm2 -g\n```\n\nStart your app with PM2:\n\n```bash\npm2 start index.js\n```\n\nVerify that the app is running with:\n\n```bash\npm2 list\n```\n\nNow, even if you disconnect from the SSH session, your application will continue running.\n\n![Node Running Server AWS](./node.js%20server.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsankalpharitash21%2Fnodejs_aws","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsankalpharitash21%2Fnodejs_aws","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsankalpharitash21%2Fnodejs_aws/lists"}