🌐

Understanding Infrastructure as Code

Aug 10, 2024

Day 16 - Infrastructure as Code

Introduction

  • Presenter: Abhishek
  • Topic: Infrastructure as Code
  • Purpose: Understand the problem, use cases, and solutions related to Infrastructure as Code.

Previous Topics

  • Discussed Configuration Management
  • Explored Ansible
  • Dynamic Inventory will be addressed in a dedicated video.

Understanding the Problem

  • Scenario: DevOps engineer at Flipkart
    • Need to create compute resources (CPU, RAM, hardware) on various platforms:
      • AWS
      • Azure
      • Google Cloud Platform
      • On-premises servers
  • Challenge: Managing hundreds of applications (300 applications) requires efficient server deployment.

Infrastructure Deployment Choices

  • Flipkart decides to host infrastructure on AWS.
  • Automate the process using:
    • AWS CLI
    • AWS CloudFormation Templates (CFT)
    • AWS CDK

Example Usage

  • Developer requests 10 EC2 instances
    • Use CFT script for automation
  • If Flipkart shifts from AWS to Azure:
    • Requires rewriting scripts from CFT to Azure Resource Manager (ARM) templates.

Migration Challenges

  • Example of shifting from:
    • AWS to Azure
    • Azure to On-Premise (using OpenStack)
  • Heat Templates: Used for OpenStack automation.

Hybrid Cloud Models

  • Organizations may use a combination of cloud providers (Hybrid Cloud).
  • Example:
    • AWS for storage services
    • Azure for DevOps services
  • DevOps engineers need to learn multiple tools for different providers.

Solution: Terraform

  • Developed by HashiCorp.
  • Goal: Simplify learning for DevOps engineers by using a single tool (Terraform) for managing multiple cloud providers.
  • Concept: API as Code
    • Allows for automation across different providers with minimal changes during migration.

How Terraform Works

  • Write Terraform scripts to automate any cloud provider.
  • Terraform converts these scripts into API calls for the respective cloud provider.
  • Example: Writing an EC2 instance configuration will be translated to an AWS-readable API call.

Understanding API

  • API: Application Programming Interface
  • Allows programmatic interaction with applications, e.g., retrieving information from Google without a browser interface.

Terraform's Role

  • Instead of directly interacting with cloud provider APIs, Terraform abstracts this complexity.
  • Users write scripts, and Terraform handles API requests behind the scenes.

Key Takeaways

  • Infrastructure as Code (IaC): Automating infrastructure setup using code.
  • API as Code: Using APIs for programmatic infrastructure management.
  • Terraform simplifies the management of cloud resources across multiple platforms.

Next Steps

  • Tomorrow's class: Live examples of Terraform in action (installation, creating EC2 instances, etc.).

Closing

  • Questions and feedback encouraged in the comments.
  • Reminder to like the video and subscribe to the channel.