Skip to content

Quick Guide for AWS

Published:

Table of contents

Open Table of contents

Deploy to EC2

Security Group

Setup the following security group configuration

Preffered security group for ec2 instance

Connect with SSH

Install node with nvm

Checkout the official documentation on how to setup node in ec2 linux

Port Forwarding from 80 to 8000

Use the following command for port forwarding

sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8000

Install MongoDB community edition

The result should be Amazon Linux or Amazon Linux AMI

Checkout common errors faced during this

Checkout the offficial Documentation

Install PostgreSQL

Follow this article for installing PostgreSQL

after install use this command to open db shell

sudo su - postgres

Transfer node project to ec2

You can use programs like filezilla to transfer project files the method I use personally is to send zipped file using scp command

Run Application with screen

install the node modules and run the app with screen

screen npm start

you can detach the screen without terminating by

i. ctrl+A ii. D


Bucket Policy for S3


Use the following bucket policy in S3 Bucket for public read access

{
  "Version": "2008-10-17",
  "Statement": [
    {
      "Sid": "AllowPublicRead",
      "Effect": "Allow",
      "Principal": {
        "AWS": "*"
      },
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::<bucket_name>/*"
    }
  ]
}

CloudFront Guide


Use this tutorial for setting up cloudfront


  1. move nameserver to Route 53
  2. request certificate from ACM
  3. create load balancer targeting to ec2 instance
  4. create a record pointing to load balancer in route 53
If you found this article helpful consider supporting me by Buying me a Coffee Buy Me A Coffee


Previous Post
Understanding and Creating Sitemaps for SEO
Next Post
Quick Guide for Flutter