terraform AWS - Introduction - Session 1

 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Course Main Repository: terraform-on-aws-ec2

Github Repsoitory :  https://github.com/stacksimplify/terraform-on-aws-ec2

IAC DevOps Repository: terraform-iacdevops-with-aws-codepipeline

Github Repsoitory : https://github.com/stacksimplify/terraform-iacdevops-with-aws-codepipeline

Github Repsoitory : 

https://github.com/stacksimplify/hashicorp-certified-terraform-associate/tree/main/02-Terraform-Basics

Github Repsoitory :  

https://github.com/stacksimplify/terraform-on-aws-ec2/tree/main/02-Terraform-Basics

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


What are we going to learn.


1. First we will create a 3 tier architecture .









We will start with a basic terraform workflow .


We will learn about the top level terraform block .


Next we will learn about Meta-Arguments of a resource 

Terraform Fundamental -- Can take 4 hours


After completing the fundamentals, we will move into the real world environment. 







In addition to that you are going to have a NAT gateway in the public subnet , for the private subnet EC2 instances outbound communication  

There is something called VPC instance + EC2 instance | Security Group as part of this section you will build private EC2 instances here and provide a user data for a sample application in addition to that you are going to have a Basion EC2 instance to connect to your EC2 instance .



the above are the configuration for 

1. VPC
2. securitygroups
3. ec2instance



We will create the classic load balancer in public subnet


You will then move on and implement the Application Load Balancer , once you complete Classic Load Balancer you will move to ALB



Using the load balancer DNS name you will access the sample app present in the EC2 instances in the Private subnet . 
Next we shall move into Context Path Routing in ALB , so you will write your terraform configuration in such a way that you will implement when the /* comes , respond with fixed response and when /app1* comes it goes to A1 EC2 instances , and when you get /app2* go to A2 EC2 instances as depicted in the below diagram.


In Addition you will have Certitification Manager User here to create the SSL certificates for 
http://apps.devopsincloud.com and that DNS will also be registered in route53 

This entire use case we are going to build using terraform . From here we shall move into Host Header Based Routing . This simply means when your dns names start with app1 it will for to app1 instance and when the dns begins with app2 .com it goes to A2 instance .

Host Header Based Routing : the URL begins with the name /app1   --  /app2 etc



From there you will move to ALB custom based routing & Redirects with Query String and Host Header 

When you have the custom  header cheader=my-app-1 then send the request to App 1, and when you have custom header cheader=my-app-2 . send the request to app2 .  This is custom header based routing that you want to implement. 

 ALB custom header based routing & redirects with query string routing and host header 

The next thing is Host header external redirect 302 


Whenever you access >> http://azure-aks.devopscloud.com  it will go to application load balancer and redirect to some external website .

The blue colour one



Using Query string redirect using terraform . 


This query string will redirect you to 



This is whatever you have configured there

Then you will move on to something called DNS to DB using Terraform 



Here we have have another app in the next private subnet RDS Database . And we are also going to be deloying our App3 . And App1 and App2 are going to remain the same .

And on the root context you will have a sample user management web app App3 - whenever you provide the user name and password it will fetch the information from the RDS DB. whatever sample data is present in the database . All these you are going to do in the DNS to DB in terraform . 

Next we move on to upgrading terraform modules

So far the modules that you have used from public registry has these versions


And you feel like upgrading them to the latest version . 

  • How are you going to upgrade
  • Impact analysis that you will do
  • And accordingly you will make changes to your application and then upgrade it.

Next we come to this 

> AWS Autoscaling with launch configuration using Terraform



So far you are using the manual EC2 instances here 

Then you will move on to implement the Autoscaling groups with launch configuration

you will implement the same thing with Launch Template .


Next we will learn 

AWS Network load Balancer with TCP and TLS Listeners using Terraform


Next 

> AWS Cloud Watch Using Terraform


You will use auto scaling Alarms , ALB alarm . Using cloud watch synthetics you will implement the heart beat monitor.

Next you will  move on to building Terraform modules locally . There are two approaches that you need to follow

We will discuss in detail






Next : Terraform Remote State Datasource



In project 1 we are going to have the VPC resources



Finally we will enter the IaC DevOps on AWS , 


Here we will check in all our terraform configuration to GitHub & also we will deploy a code pipeline for dev deploy stage and staging deploy stage, in between we will also implement the manual approval stage. So whenever user checks in the code to GitHub so that the code pipeline will be triggered as a part of dev deploy stage it is going to create all these resource .

So we are going to create two environment Dev and Prod with similar configurations. 


The entire code is available for you in the GitHub repository .















Comments

Popular posts from this blog

Terraform : AWS : Terraform on AWS with SRE & IaC DevOps | Section 2 : Terraform basics

Terraform : AWS : Terraform on AWS | Section 4: Terraform Input Variables and Datasources

Terraform VPC - on AWS : Three tier architecture design