Skip to content

Deploy Instagram clone and the required infrastructure using Terraform.

Notifications You must be signed in to change notification settings

mleager/Instagram-Clone

Repository files navigation

Instagram Clone - MERN Stack

Create AWS infrastructure and deploy React frontend & Node/Express backend using Terraform.

Source Code Repo for this Project: https://github.com/mleager/instagram-mern

ORIGINAL PROJECT BY: Jigar Sable

  • Project was modified to use Postmark instead of SendGrid.

Project Resources:

VPC

  • and accompanying IGW, NAT, Routing Tables, etc.

2 Application Load Balancers

  • 1 Internet-Facing ALB for Frontend, 1 Internal ALB for Backend

2 Autoscaling Groups

  • 1 for each of the Frontend & Backend

MongoDB

  • MongoDB resources for storing site data

DNS

  • ACM and Route53 records for DNS

Security Groups

  • Security Groups for AWS resources

Instructions:

Apply Terraform config files

NOTE:
* MongoDB Provider requires Public and Private Access Keys.
* The 0-provider.tf file shows 2 options for using the Keys:

  Set Keys as ENV Varibles using your Local Terminal
    - MONGODB_ATLAS_PUBLIC_KEY=xxxxxxxx
    - MONGODB_ATLAS_PRIVATE_KEY=xxxxxxxxxxxxxxxxxxxx
      
  Set Keys are Terraform variables in `terraform.tfvars`
    - Make sure this file is not commited to Public Repos and stored properly

Start the Backend Server

  1. SSM into instance (allowed by IAM Instance Profile)
  2. cd /usr/share/nginx/backend
  3. Add MongoDB Connection String to '/backend/config/config.env'
  * Must append "/?retryWrites=true&w=majority" to connect MongoDB with Node.js Backend *

MONGO_URI=mongodb+srv://<username>:<password>@mongo-cluster.abcdefg.mongodb.net/?retryWrites=true&w=majority

                  <mongo_connection_string>/?retryWrites=true&w=majority
  1. $ sudo npm start

Start Frontend Server

  1. SSM into instance (allowed by IAM Instance Profile)
  2. confirm Nginx is running
    sudo systemctl status nginx
  3. cd /usr/share/nginx/frontend
  4. $ sudo npm start

About

Deploy Instagram clone and the required infrastructure using Terraform.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published