training.shoppinpal.com
  • Introduction
  • 1. The Ideal Workspace
    • The Perfect Machine
      • For Biz Team
      • For Developers
      • For Designers
    • Setup a machine in the cloud
      • Solution
      • Setup box on Azure
        • Create a machine on Azure
        • Test drive your remote machine
        • Setup Dropbox On Azure
      • Setup box on DigitalOcean
        • Setup UI
        • Shared FileSystem
          • Dropbox
            • Use locally developed node modules in another project
          • sshfs
        • Long Running Sessions
      • Feedback
  • 2. Learning Git
    • Static Code Analysis
  • 3. The Backend
    • Use Containers
    • Setup a loopback project
    • Lockdown
    • Build a better mousetrap
    • The abyss stares back
    • Built-in models
    • Extending built-in models
    • Understanding UserModel
    • Boot Scripts
    • Promises
    • Find roles for current user
    • Loopback Console
    • Current User
  • 4. Multi-tenancy With Loopback
    • What is Multi-Tenancy
    • Architecting with Loopback
    • Define scope for Roles
    • Role Resolvers
    • Access Control For Tenants
    • Better Programming with multi-tenancy
  • 5. The Frontend
    • The Browser
    • Unit Testing
      • Motivation behind this blog
      • How to write a test
      • Karma and Jasmin
      • Writing Tests
    • End-2-End Testing
    • Angular 1.x
    • Angular 2
      • Testing
  • 6. ElasticSearch
    • Better Search with NGram
    • NGram with Elasticsearch
    • Fun with Path Hierarchy Tokenizer
    • Working with Mappings and Analyzers
  • 7. Promises
    • What are Promises
    • Promise Implementations
    • Nuances
    • What should we use
  • 8. Learning Docker
    • Docker Swarm
  • 9. Queues & Workers
    • PHP workers in AWS EBS
    • NodeJS workers in AWS EBS
      • SQS Daemon by AWS
      • SQS Daemon in NodeJS
      • SQS polling by worker
    • Gearman
  • 10. Docker
    • Capabilities
  • Appendix
    • Bug in WebStorm deployments
    • The Perfect Terminal
    • Scalable App Deployment with AWS
    • Chrome Tips & Tricks
    • Host your own Gitbook
    • Gitbook Tips & Tricks
    • How to handle support incidents
    • Dev Resources
    • Debug e2e Tests on CircleCI
    • Logging
    • Authentication Principles
    • Mac
    • nvm
    • Unify testing with npm
      • Debugging Mocha
    • Sequence Diagrams
    • Project Sync via IDE
      • SFTP with WebStorm
      • SFTP with Visual Studio
    • Soft Linking
    • NodeJS Profiling
      • How to find node.js performance optimization killers
    • Setup Packer on Azure
Powered by GitBook
On this page
  • Walkthrough
  • VPC
  • Application Layer
  • LoadBalancer
  • CloudFront
  1. Appendix

Scalable App Deployment with AWS

PreviousThe Perfect TerminalNextChrome Tips & Tricks

Last updated 7 years ago

Let's say we have a web application named MyApp and we want to deploy it to AWS in a scalable fashion. How do we do it?

Walkthrough

As described in above diagram the deployment architecture of AWS consist of following components:

VPC

  • MyApp VPC

    • All EC2 instances are placed inside MyApp VPC for security purposes. MyApp VPC consists of 4 subnets:

      • Private-1a (Private subnet in AZ- 1a)

      • Private-1b (Private subnet in AZ- 1b)

      • Public-1a (Public subnet in AZ- 1a)

      • Public-1b (Public subnet in AZ- 1b)

    • Private Subnet - Outer services can not access the instance directly. The instances do not have a public IP. Whereas, the instances themselves can access the internet and any outer services via NAT Internet Gateway.

    • Public Subnet - Outer Services can access such instances directly through their public IP.

  • Database Layer

    • A single node of MongoDB instance will suffice for MyApp.

    • It can be a Primary Node hosted in Private Subnet of VPC.

    • A sample setup may look like:

      • MongoDB - PrimaryNode

        • Availability Zone: ap-southeast-1a

        • Instance Size : M3.medium (1 vCPU, 3.75GB RAM, 60GB EBS, Volume attached)

Aiming Higher

For High Availability (HA) there should be one more DB instance in another Availability Zone (AZ) i.e 1b which can act as the replica for PrimaryNode.

Application Layer

  • MyApp NodeJS Application Layer

    • This layer Exists in Private Subnets (1a, 1b) of VPC i.e they are not directly accessible like DB layer.

    • This is the layer where MyApp is deployed via AWS EC2 Container Service.

    • A sample Single EC2 instance configuration in this layer:

      • Instance Size : T2.micro (1 vCPU, 1GB RAM, 20GB EBS)

    • The instances are kept in an AutoScaling Group where desired Instances are 2 and ECS Service desired Running tasks are 2.

    • Count is kept at 2 deliberately, for smooth deployment.

LoadBalancer

LoadBalancer (LB) is hosted in Public Subnets of VPC For High Availability. Ports 80 & 443 of LB are mapped with port 3000 of EC2 instances running MyApp.

CloudFront

CloudFront is placed for caching the static contents like JS and CSS files next to the LB which will serve them and reduce requests to the Original source.