Ankit Jodhani
Hi folks, this is Ankit jodhani, a DevOps enginner, I recently graduated from university and currently exploring and learning DevOps and cloud with AWS. In this project, I'm going to implement 2 tier architecture using Terraform which should be highly available and scalable. so to achieve that we gonna use the following list of services of AWS. you can use any cloud provider that you like. in my case it is AWS.
so let's get started.
Two-tier architecture, also known as client-server architecture, is a software design pattern that divides an application into two main parts or tiers: the client tier and the server tier. Each tier has specific responsibilities and interacts with each other to provide functionality to end-users.
Let's see the architecture of today's project. we are going to follow a goal-driven approach that helps us to put in minimum effort and gain lots of results. it's very important to understand what we are going to build and to understand you can follow the below architecture. I request you please go through it once. it helps you a lot while building this project.
I hope you have installed all the software and tools. now it's time to open the AWS console. please head over to IAM service.
aws configure
. it will ask for your Acess key ID and secret key id. please enter what we have just created. furthermore**,** it will ask output format JSON
default region us-east-1
. you can enter the region where you want to deploy your app. Follow the below images to get more ideas. Finally, it's time to write your infrastructure. but before you jump on it. let me clarify a few things, we are going to best practices while writing code.
NOTE: You will get all the code and files on my GitHub repository and I'll share the link with you at the END of the blog. but let me share a few things that you need to take care of while writing code in the backend.tf file.
book_shop_app/backend.tf
terraform {
backend "s3" {
bucket = "BUCKET_NAME"
key = "backend/FILE_NAME_TO_STORE_STATE.tfstate"
region = "us-east-1"
dynamodb_table = "dynamoDB_TABLE_NAME"
}
}
Create one file with the name of terraform.tfvars in the project directory.
book_shop_app/terraform.tfvars
REGION = ""
PROJECT_NAME = ""
VPC_CIDR = ""
PUB_SUB_1_A_CIDR = ""
PUB_SUB_2_B_CIDR = ""
PRI_SUB_3_A_CIDR = ""
PRI_SUB_4_B_CIDR = ""
PRI_SUB_5_A_CIDR = ""
PRI_SUB_6_B_CIDR = ""
DB_USERNAME = ""
DB_PASSWORD = ""
CERTIFICATE_DOMAIN_NAME = ""
ADDITIONAL_DOMAIN_NAME = ""
Note: above file is very important to set up the infrastructure so make sure you fill all the variable's values carefully.
Please visit my Github repository for to source code. and there you will find instructions to clone the repo and run it on your local machine.
Github link: https://github.com/AnkitJodhani/3rdWeekofCloudOps
let's see what Terraform created on our AWS console.
cloudacademy.com/blog/architecting-on-aws-t..
hands-on.cloud/cloudfront-terraform-example..
gmusumeci.medium.com/how-to-create-route-53..
registry.terraform.io/providers/hashicorp/a..
youtube.com/watch?v=ZP_vAbjfFMs
youtube.com/watch?v=oohXRXjahFA&list=PL..
youtube.com/watch?v=1OYONBN2jgE&list=PL..
https://spacelift.io/blog/terraform-best-practices
🙏Thank you for reading...
please follow for more such content😅.
🧑💻 Github repository link: github.com/AnkitJodhani/3rdWeekofCloudOps
🧑💻 Github profile: https://github.com/AnkitJodhani
✈️ Linkedin: https://www.linkedin.com/in/ankit-jodhani/