Skip to content

Designing a Three-Tier Architecture in AWS using Terraform

Notifications You must be signed in to change notification settings

tylrroche/aws-3-tier-vpc

Repository files navigation

Welcome to my AWS Demo!

This is a demo repo that leverages AWS to deliver a three-tier example.

Features

  • Each resource in Terraform is broken down into a .tf configuration file. This makes the code cleaner, easier to troubleshoot, and easier to read and understand.
  • A variable.tf file holds all the variable configuration.
  • A my.tfvars holds all the values to terraform variables.
  • The terraform code automatically uses variables for your awscli configuration.
  • This code uses a remote terraform state file.

Configurations

  • alb_listener.tf - Provides a Load Balancer Listener resource.
  • asgroup.tf - Provides an Auto Scaling Group resource.
  • backend.tf - Provides remote state file
  • bootstrap.sh - A bash script used to bootstrap ec2 to install Apache
  • db_sub.tf - Provides an RDS DB subnet group resource.
  • ec2.tf - Provides an EC2 instance resource. This allows instances to be created, updated, and deleted. Instances also support provisioning.
  • inetgw.tf - Provides a resource to create a VPC Internet Gateway.
  • keypair.tf - Provides an EC2 key pair resource. A key pair is used to control login access to EC2 instances.
  • launchconfig.tf - Provides a resource to create a new launch configuration, used for autoscaling groups.
  • lbtg.tf - Provides a Target Group resource for use with Load Balancer resources.
  • loadbalancer.tf - Provides a Load Balancer resource.
  • provider.tf - Providers allow Terraform to interact with cloud providers, SaaS providers, and other APIs.
  • rds.tf - Provides an RDS instance resource. A DB instance is an isolated database environment in the cloud. A DB instance can contain multiple user-created databases.
  • routetable.tf - Provides a resource to create a VPC routing table.
  • routetableassociation.tf - Provides a resource to create an association between a route table and a subnet or a route table and an internet gateway or virtual private gateway.
  • securitygroup.tf - Provides a security group resource.
  • subnet.tf - Provides an VPC subnet resource.
  • targetgroup.tf - Provides a Target Group resource for use with Load Balancer resources.
  • variable.tf - Input variables serve as parameters for a Terraform module, allowing aspects of the module to be customized without altering the module's own source code, and allowing modules to be shared between different configurations.
  • vpc.tf - Provides a VPC resource.
  • my.tfvars - Defined variables. (not included, sensitive information)

Tech

  • Terraform - IAC Tool
  • Bash - Bash is the shell, or command language interpreter, for the GNU operating system.
  • Apache - Apache is an open-source and free web server software.
  • Amazon Web Services - Cloud Computing Services

Installation

First, you have to initialize a working directory containing Terraform configuration files.

terraform init

Second, you have to evaluate Terraform configuration to determine the desired state of all the resources it declares, then compares that desired state to the real infrastructure objects being managed with the current working directory and workspace.

terraform plan -var-file my.tfvars

Finally, apply the changes required to reach the desired state of the configuration, or the pre-determined set of actions generated by a terraform plan execution plan.

terraform apply -var-file my.tfvars

Considerations

If client wanted to become more cloud naive and more portable I would recommend Docker. I would build my application in docker, store my images in Amazon Elastic Container System. If our client wanted to become serverless, I would use Amazon Fargate because you don't have to manage your infrastructure.

Instructions on how to use them in your own application are linked below.

Upgrades Details
Docker here
Amazon ECS here
Amazon Fargate here

Additional Notes

Thank you again Kyle for the opportunity!!!

About

Designing a Three-Tier Architecture in AWS using Terraform

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published