{"id":24650454,"url":"https://github.com/ashifhassandev/aws-ec2-node-hosting","last_synced_at":"2026-04-18T13:38:04.455Z","repository":{"id":272378718,"uuid":"913115475","full_name":"ashifhassandev/aws-ec2-node-hosting","owner":"ashifhassandev","description":"𝐀 𝐬𝐭𝐞𝐩-𝐛𝐲-𝐬𝐭𝐞𝐩 𝐠𝐮𝐢𝐝𝐞 𝐭𝐨 𝐡𝐨𝐬𝐭𝐢𝐧𝐠 𝐚 𝐍𝐨𝐝𝐞.𝐣𝐬 𝐚𝐩𝐩𝐥𝐢𝐜𝐚𝐭𝐢𝐨𝐧 𝐨𝐧 𝐀𝐖𝐒 𝐄𝐂𝟐 𝐰𝐢𝐭𝐡 𝐍𝐠𝐢𝐧𝐱 𝐚𝐧𝐝 𝐏𝐌𝟐.","archived":false,"fork":false,"pushed_at":"2025-01-07T09:34:33.000Z","size":1,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-20T20:55:16.550Z","etag":null,"topics":["aws","ec2","nginx","nodejs","pm2"],"latest_commit_sha":null,"homepage":"","language":null,"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/ashifhassandev.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}},"created_at":"2025-01-07T04:10:05.000Z","updated_at":"2025-01-19T09:23:52.000Z","dependencies_parsed_at":"2025-01-14T03:38:20.260Z","dependency_job_id":"7f9dc762-9b63-4207-a1d3-dde5d40bade8","html_url":"https://github.com/ashifhassandev/aws-ec2-node-hosting","commit_stats":null,"previous_names":["ashifhassandev/aws-ec2-node-hosting"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ashifhassandev/aws-ec2-node-hosting","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashifhassandev%2Faws-ec2-node-hosting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashifhassandev%2Faws-ec2-node-hosting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashifhassandev%2Faws-ec2-node-hosting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashifhassandev%2Faws-ec2-node-hosting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ashifhassandev","download_url":"https://codeload.github.com/ashifhassandev/aws-ec2-node-hosting/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashifhassandev%2Faws-ec2-node-hosting/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31971488,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"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","ec2","nginx","nodejs","pm2"],"created_at":"2025-01-25T18:15:08.747Z","updated_at":"2026-04-18T13:38:04.438Z","avatar_url":"https://github.com/ashifhassandev.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Guide to Hosting Your Project on AWS EC2\n\n## Prerequisites:\n1. AWS account\n2. Node.js and NPM installed locally\n3. Basic knowledge of Linux and SSH\n4. Project ready to deploy\n\n## Step 1: Launch an EC2 Instance\n1. Log in to your AWS Management Console.\n2. Navigate to the EC2 service.\n3. Click on \"Launch Instance.\"\n4. Select an Amazon Machine Image (AMI): Choose Ubuntu 20.04.\n5. Select Instance Type: Choose \"t2.micro\" (Free tier eligible).\n6. Configure Instance: \n    - Add a key pair for SSH access.\n    - Add a security group with rules to allow HTTP, HTTPS, and SSH traffic.\n7. Launch the instance.\n\n## Step 2: Configure DNS Records\n1. Log in to your domain registrar (e.g., GoDaddy, Namecheap, etc.).\n2. Go to the DNS management section for your domain.\n3. Add the following records:\n    - **A Record**:\n        - Host: `@`\n        - Points to: `your-ec2-public-ip`\n        - TTL: Default or 1 hour\n    - **CNAME Record** (optional, for `www`):\n        - Host: `www`\n        - Points to: `your-domain.com`\n        - TTL: Default or 1 hour\n4. Save the changes.\n5. It may take a few minutes to a few hours for DNS propagation.\n\n## Step 3: Connect to Your EC2 Instance\n1. Download the private key file (.pem) for the key pair you created.\n2. Open your terminal and navigate to the directory containing the .pem file.\n3. Run the command:\n    ```bash\n    ssh -i \"your-key.pem\" ubuntu@your-ec2-public-ip\n    ```\n4. Replace \"your-key.pem\" with your key file and \"your-ec2-public-ip\" with the public IP of your instance.\n\n## Step 4: Set Up Your Environment\n1. Update the system:\n    ```bash\n    sudo apt update \u0026\u0026 sudo apt upgrade -y\n    ```\n2. Install Node.js and NPM:\n    ```bash\n    curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -\nsudo apt install -y nodejs\n    ```\n3. Verify installation:\n    ```bash\n    node -v\n    npm -v\n    ```\n4. Install PM2 globally for process management:\n    ```bash\n    sudo npm install pm2 -g\n    ```\n\n## Step 5: Deploy Your Project\n1. Clone your project repository:\n    ```bash\n    git clone https://github.com/your-username/your-repo.git\n    ```\n2. Navigate to the project directory:\n    ```bash\n    cd your-repo\n    ```\n3. Install dependencies:\n    ```bash\n    npm install\n    ```\n4. Start the application with PM2:\n    ```bash\n    pm2 start app.js\n    ```\n    Replace `app.js` with your main entry file.\n5. Save the PM2 process list to auto-start on reboot:\n    ```bash\n    pm2 save\n    pm2 startup\n    ```\n\n## Step 6: Configure Nginx as a Reverse Proxy\n1. Install Nginx:\n    ```bash\n    sudo apt install nginx\n    ```\n2. Configure Nginx:\n    ```bash\n    sudo nano /etc/nginx/sites-available/default\n    ```\n    Replace the file content with:\n    ```\n    server {\n        listen 80;\n        server_name your-ec2-public-ip;\n\n        location / {\n            proxy_pass http://localhost:3000;\n            proxy_http_version 1.1;\n            proxy_set_header Upgrade $http_upgrade;\n            proxy_set_header Connection 'upgrade';\n            proxy_set_header Host $host;\n            proxy_cache_bypass $http_upgrade;\n        }\n    }\n    ```\n    Replace `your-ec2-public-ip` with your instance's public IP and `3000` with your app's port.\n3. Restart Nginx:\n    ```bash\n    sudo systemctl restart nginx\n    ```\n\n## Step 7: Test Your Application\n1. Open your browser and visit your domain (e.g., `http://your-domain.com`).\n2. Your application should be live.\n\n## Additional Resources\nFor a full detailed guide to hosting a Node.js app on AWS EC2, see this link:\n[https://waterrmalann.notion.site/A-simple-guide-to-hosting-a-Node-js-app-on-AWS-EC2-6e05ee8c5689452f94a2c550f66aeecd](https://waterrmalann.notion.site/A-simple-guide-to-hosting-a-Node-js-app-on-AWS-EC2-6e05ee8c5689452f94a2c550f66aeecd)\n\n## Notes:\n- Make sure to replace placeholders like `your-key.pem`, `your-ec2-public-ip`, and `3000` with actual values.\n- Always keep your `.pem` file secure.\n- Use environment variables for sensitive data in your project.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashifhassandev%2Faws-ec2-node-hosting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashifhassandev%2Faws-ec2-node-hosting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashifhassandev%2Faws-ec2-node-hosting/lists"}