Development Notes
  • Introduction
  • Programming Langauges
    • Java
      • Cache
      • Java Fundamentals
      • Multithreading & Concurrency
      • Spring Boot
        • Spring Security
        • Development tips
      • ORM
        • Mybatis
      • Implementation & Testing
    • Node.js
      • Asynchronous Execution
      • Node.js Notes
    • Python
      • Memo
  • Data Structure & Algorithm
  • Database
  • Design Pattern
  • AWS Notes
    • Services
      • API Gateway
      • CloudHSM
      • Compute & Load Balancing
        • Auto Scaling Group
        • EC2
        • ECS
        • ELB
        • Lambda
      • Data Engineering
        • Athena
        • Batch
        • EMR
        • IoT
        • Kinesis
        • Video Streaming
        • Quicksight
      • Deployment
        • CloudFormation
        • Code Deploy
        • Elastic Beanstalk
        • OpsWorks
        • SAM
        • SSM
      • ElasticSearch
      • Identity & Federation
        • Directory Service
        • IAM
        • Organizations
        • Resource Access Manager (RAM)
        • SSO
        • STS
      • KMS
      • Management Tools
        • Catalog
        • CloudTrail
        • CloudWatch
        • Config
        • Cost Allocation Tags
        • GuardDuty
        • Savings Plans
        • Trusted Advisor
        • X-Ray
      • Migration
        • Cloud Migration: The 6R
        • Disaster Recovery
        • DMS
        • VM Migrations
      • Networking
        • ACM
        • CloudFront
        • Direct Connect
        • EIP & ENI
        • Network Security
        • PrivateLink
        • Route53
        • VPC
        • VPN
      • Service Commnucation
        • Amazon MQ
        • SNS
        • SQS
        • Step Functions
        • SWF
      • Storage
        • Aurora
        • DynamoDB
        • EBS
        • EFS
        • ElastiCache
        • RDS
        • Redshift
        • S3
        • Storage Gateway
      • Other Services
        • Alexa for Business, Lex, Connect
        • AppStream 2.0
        • CloudSearch
        • Comprehend
        • Data Tools
        • Elastic Transcoder
        • Mechanical Turk
        • Rekognition
        • WorkDocs
        • WorkSpaces
    • Well Architect Framework
      • Security
      • Reliability
      • Performance Effeciency
      • Cost Optimization
      • Operational Excellence
    • Labs
      • Webserver Implementation
      • ELB Implementation
      • Auto-scaling Implementation
      • A 3-tier Architecture In VPC
  • Architecture
    • Security
  • Spark
    • Memo
  • Conference Notes
    • Notes of JCConf 2017
  • AI Notes
Powered by GitBook
On this page

Was this helpful?

  1. AWS Notes
  2. Labs

A 3-tier Architecture In VPC

PreviousAuto-scaling ImplementationNextArchitecture

Last updated 5 years ago

Was this helpful?

Purpose

  • To Implement a webserver and a MySQL in VPC

    • Create a VPC and attach it to 1 public Subnet and 1 private Subnet

    • Create a webserver in the public Subnet

    • Create a NAT Gateway/instance for all private Subnets in the VPC to get Internet traffic

    • Create a MySQL server in the private Subnet, and make it accessible under public Subnet only

Steps

  • Create a VPC

    • Give VPC name, IPV4 CIDR block

    • Once created, a default Route Table, a default Network ACL, a default Security Group are given

  • Create 2 Subnets (1 public Subnet and 1 private Subnet)

    • Give Subnet name, VPC ampping, AZ mapping, IPV4 CIDR block

    • Select the public Subnet -> Subnet Actions -> Modify auto-assign IP asettings -> Enable auto-assign IPV4 addresse

  • Attach a Internet Gateway to VPC

    • Give Internet Gateway name

    • Attach it to the created VPC

  • Create a custom Route Table

    • Give Route Table name, VPC mapping

    • Create a route out

      • Tab "Routes" -> Edit -> Add another route, add Destination: "0.0.0.0/0", Target: ${internet_gateway_name} -> save

    • Set Subnet association

      • Tab "Subnet Association" -> Edit -> Add Subnets associations -> choose 1 Subnet to make it public -> save

    • Not to modify the main Route Table directly is a practice for security. When creating new Subnets, they will be associated to the main Route Table.

  • in the public Subnet

    • At "Congifure Instance Details", to choose the custom VPC and Subnet

    • Create a Security Group for webserver

  • Create a NAT, there are two ways:

    1. Create a NAT Gateway (recommended)

      • Create NAT Gateway under the public Subnet and create new EIP to get a dynamic IP

      • Select the main Route Table of the VPC -> tab Routes -> Edit -> to add Destincation: 0.0.0.0/0, Target: ${nat_gateway}

    2. Create a NAT instance

      • Create EC2 instance with AMI in Community AMIs that filtered with keyword: nat

      • Put it under public Subnet of the VPC, and specify a Security Group freely.

      • Once the instance is running, Actions -> Networking -> Change Source/Desc. Check to disable source/destination check

      • Select the main Route Table of the VPC -> tab Routes -> Edit -> to add Destincation: 0.0.0.0/0, Target: ${nat_instance}

  • Create a MySQL in the private Subnet

    • Create a Security Group

      • Give name, VPC mapping

      • Add Rule for SSH, MySQL/Aurora, All ICMP (for pinging), set source: ${public_subnetc_cidr}

      • Install MySQL

        $ yum install mysql -y
Create a web server