DevOps Classroom notes 14/Sep/2024

Infrastructure as Code w.r.t Infra Provisioning

  • Infrastructure as a code (IAC) is a concept where you express your infrasturcture in a declarative way
  • We need to express
    • What we want to create/manage (Resource)
    • Outputs
  • Tools
    • AWS: Cloud formation
    • Azure: ARM Templates, Bicep
    • Terraform (open tofu): Almost any virtual environments
    • Pulumi

Three tier architecture

  • Lets look at a simple 3-tier architecture (Web sites)
  • The infrastructure to run the above app is
    • Network
    • Servers (Linux/Windows)
    • Public ip
    • DNS (optional)
  • The application deployment will be possible when this infrastructure is ready
  • Deploying application involves
    • running some commands on each server to install and configure applications
  • Terraform is used for Infra creation

Other areas to consider

  • Terraform will create infra which is virtual in nature.
  • Virtual infra can be created
    • onpremises
      • Hypervisors (Vmware)
      • Private Cloud (Openstack)
    • cloud
      • Azure
      • AWS
      • GCP
  • We need to provide information to Terraform where to create infra and pass credentials
  • Conceptually this is called as Provider in Terraform

Complications in Three Tier after running our application in production

  • To address the increasing needs of your applications we have to do scaling
    • Vertical Scaling: Increasing the resources of the same server
    • Horizontal Scaling: Increasing number of servers
  • For this every cloud offers auto scaling
    • AWS => auto scaling group
    • GCP => INstance Groups
    • Azure => Virtual machine scale sets

Terraform components (So far)

  • Provider
  • Resource

How Terraform Works

  • Terraform is developed in Google Go language
  • Terraform is a single executable.
  • Terraform can interact with specific providers (AWS, Azure, Vmware) to create/manage infrastructure Refer Here
  • Each Provider will have lots of resources which we can define to create infra.
  • What terraform can do is (as of our understanding)
    • init (initialize => downloading providers)
    • apply (create/update infra)
    • destroy (delete infrawork)

Template

  • In terraform we need to express infrastucture in a declartive fashion and what we create is called as template.
  • Terraform takes a folder as input considering all .tf files a folder
terraform {
  required_providers {
    aws = {
      source = "hashicorp/aws"
      version = "5.67.0"
    }
  }
}

provider "aws" {
  # Configuration options
  region = "ap-south-1"
}


resource "aws_vpc" "base" {
    cidr_block = "10.100.0.0/16"
    tags = {
        Name = "from devops team"
    }
}

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a comment

Turn on JavaScript to leave a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company
Exit mobile version
%%footer%%