Git Product home page Git Product logo

terraform-three-tier-architecture's Introduction

Terraform Demo of 3-Tier Architecture

Note: The Terraform configurations included in the demo does NOT involve database provisioning. The app tier of this demo is currently using a dummy httpd server, and does not involve dynamic data.

Terraform Modules used:

terraform-aws-modules/vpc/aws, terraform-aws-modules/security-group/aws, terraform-aws-modules/ec2-instance/aws, terraform-aws-modules/alb/aws

Important Steps:

  1. Initiate Terraform working directory. Config Terraform version and provider version. versions.tf, terraform.tfvars

  2. Create a VPC using Terraform VPC module. vpc.tf, vpc-variables.tf, vpc.auto.tfvars, vpc-outputs.tf

  3. Create Private EC2 instances, Bastion Host and Security Groups for them respectively.

    Note: In later steps, the Private EC2 instances would be replaced with ASG launch template.

    • Create Security Groups using Terraform Security Group module.

      securitygroup-bastion.tf, securitygroup-private.tf, securitygroup-variables.tf, securitygroup-outputs.tf

    • Get AMI dynamically using Datasource and create EC2 instances as Bastion using Terraform EC2 Module. datasource-ami.tf,ec2-bastion.tf, ec2-variables.tf, ec2.auto.tfvars, ec2-outputs.tf

    • Create a private EC2 instance for each private subnet using Terraform EC2 Module.

      ec2-private.tf, ec2-variables.tf, ec2.auto.tfvars, ec2-outputs.tf

    • Create EIP and associate it with Bastion

      eip.tf, ec2-outputs.tf

  4. Create ALB using Terraform Load Balancer Module.

    alb.tf, alb-variables.tf, alb-ouputs.tf, securitygroup-lb.tf

  5. Create Launch Template for private instances and create ASG. asg.tf, asg-variables.tf,asg-outputs.tf Note: Remove the private instances created in previous steps.


To-do:

  • Handle certain instance types not available in some azs.
  • Add Autoscaling notifications through SNS.
  • Add Target Tracking Scaling Policies for ASG to scale base on CPU utilization and ALB target request count.
  • CloudWatch Monitoring.

terraform-three-tier-architecture's People

Contributors

beckywu220 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.