Thursday, May 28, 2020

Terraform Commands

  • apply Builds or changes infrastructure

  • console Interactive console for Terraform interpolations

  • destroy Destroy Terraform-managed infrastructure

  • env Workspace management

  • fmt Rewrites config files to canonical format

  • get Download and install modules for the configuration

  • graph Create a visual graph of Terraform resources

  • import Import existing infrastructure into Terraform

  • init Initialize a Terraform working directory

  • output Read an output from a state file

  • plan Generate and show an execution plan

  • providers Prints a tree of the providers used in the configuration

  • refresh Update local state file against real resources

  • show Inspect Terraform state or plan

  • taint Manually mark a resource for recreation

  • untaint Manually unmark a resource as tainted

  • validate Validates the Terraform files

  • version Prints the Terraform version

  • workspace Workspace management

Terraform Installation on mac OS

  • Download Terraform - https://www.terraform.io/downloads.html

  • Choose mac 64 bit OS and download the package

    • Once downloaded you can extract the package and copy it in /usr/lib file and it will work for you.

  • Another way of installing it on mac OS, as below

    • Go to your mac OS command prompt and type - Brew install terraform

    • Above command will install terraform on your mac OS

Terraform Installation on Windows Machine

  • Download Terraform - https://www.terraform.io/downloads.html

  • Choose Windows 32/64 bit OS and click on appropriate, It will download the installer

  • Go to the downloaded installer and right click on that - say Extract all

  • Go to Windows command prompt

  • Change Directory to extracted terraform folder

  • Set Path is mandatory - set PATH=%PATH%;d:\Terraform\terraform_0.12.26_windows_amd64\terraform.exe

    • You can also use environment variable to set this path

  • Check if Terraform is installed or not by using terraform -version command

  • Check If all Terraform commands are there, type terraform it will list all Terraform commands

Terraform Installation on Linux Machine


  • Download Terraform - https://www.terraform.io/downloads.html
  • Choose Linux OS 32/64 bit OS - Right click and say “copy link address”
  • On your Linux machine - Create a folder called terraform
  • Change Directory cd terraform on your Linux machine
  • Run this command - wget https://releases.hashicorp.com/terraform/0.12.26/terraform_0.12.26_linux_amd64.zip
    • Note: If wget is not present please install it using yum install wget or apt-get install wget command, verify your wget version by using wget --version
  • wget will download the terraform package from terraform website
  • unzip the downloaded package by using unzip command
    • If you don’t have unzip, zip command please install the same by using below commands
      • Linux - sudo yum install -y zip unzip
      • ubuntu - sudo apt-get install zip unzip
  • unzip terraform_0.12.2_linux_amd64.zip.
  • Set Path=/terraform:$PATH OR
  • If you wish to use export it globally use below command - I personally Recommend this
    • export PATH=/home/user-name/terraform/:$PATH
  • Check if Terraform is installed or not by using terraform -version command
  • Check If all Terraform commands are there, type terraform it will list all Terraform commands


What is Terraform?

Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as custom in-house solutions. Configuration files describe to Terraform the components needed to run a single application or your entire datacenter. Terraform generates an execution plan describing what it will do to reach the desired state, and then executes it to build the described infrastructure. As the configuration changes, Terraform is able to determine what changed and create incremental execution plans which can be applied. The infrastructure Terraform can manage includes low-level components such as compute instances, storage, and networking, as well as high-level components such as DNS entries, SaaS features, etc.

Some Key points of Terraform
  • IaaC - Infrastructure as a Code
  • Automation of Infrastructure
  • Maintain the state of Infrastructure (state mgmt)
  • Maintain Infrastructure change history using version control system like Git
  • Terraform can automate any cloud and on premises infrastructure like VMware, AWS, Azure, GCP & Digital Ocean
Fundamental of Terraform
  • Unify the view of resources using IaaC
  • Support modern data centre (Iaas, PaaS & SaaS)
  • Expose a way satisfy the predictability change Infrastructure
  • Manage anything with API
  • Provides high level description of Infrastructure
  • Support parallel mgmt of resources
  • Separate planning from execution (dry-run) - By running a “plan”command
  • Detailed documentation, lots of example, template provided by HashiCorp
Infrastructure as a Code
  • Provide a coding workflow to create infrastructure
  • Expose workflow for managing updates to existing Infrastructure
  • Integrate with application code workflow like Git & Code Review
  • Provide modular, shareable component for separation of concern
  • Human readable configuration is designed for human consumption, so user can quickly interpret and understand their infrastructure configuration
  • HCL (HashiCorp Coding Language) includes full json parser for machine-generated configuration.


Tuesday, May 26, 2020

Why DevOps?

DevOps is a culture where collaboration between development, operations, and business teams is considered a critical aspect of the DevOps journey. It’s not solely about the tools and DevOps in an organization creates continuous value for customers. Tools are only one of the pillars, the other being People and Processes.
DevOps increases organizations’ capability to deliver high-quality solutions at a swift pace. It automates all processes starting from build to deployment of an application or a product. This paper will provide a comprehensive understanding to apply DevOps methods, tools, and frameworks in their Organization’s DevOps journey.
Instead of releasing a large number of application features, companies are trying to see if a small number of features can be rolled-out to their customers through a series of release iterations. This has several advantages like better quality of software, quick feedback from customers, etc. which in turn ensures high customer satisfaction. To achieve these objectives, companies are required to:
  • The lower failure rate for new releases
  • Increase deployment frequency
  • Quicker mean time to recovery in the event of a new release crashing the application
  • Shortened lead time between fixes
DevOps fulfills all these objectives and helps in achieving seamless delivery. Organizations like Microsoft, Google, Etsy, Facebook, Netflix and Amazon have adopted DevOps to achieve levels of performance that were unthinkable even a few years ago. They are doing tens, hundreds, or even thousands of deployments per day while delivering world-class reliability, stability, and security.
DevOps is a process framework that ensures collaboration between Development and Operations Team to deploy code to production environment faster in a repeatable and automated way. The word DevOps is an amalgamation of two words development and operations. DevOps helps to increases the speed to deliver applications and services faster. It allows organizations to serve their customers efficiently and become more competitive in the market. In simple terms, DevOps can be defined as an alignment between development and IT operations with better communication and collaboration.
  • Earlier to DevOps, the development and operation team worked in total isolation.
  • Testing and Deployment were isolated phases and were done after design and build. Hence they required more time than actual build cycles.
  • Without DevOps, team members are spending a large amount of their time in testing, deploying, and designing instead of focusing on the core part that is creating business services.
  • Manual code deployment will lead to errors in production
  • Development & Operation teams have a separate-timelines and are not in sync, causing additional delays

DevOps Life-Cycle
  • Continuous Planning
  • Collaborative Development 
  • Continuous Testing
  • Continuous Release & Deployment
  • Continuous Monitoring 
  • Continuous Feedback and Optimization
Pictures says a lot 
















What is DevOps?

Multiple ways of expressing DevOps

Long story in short - DevOps is a culture, a practice towards betterment 


DevOps is a set of practices that combines software development and information-technology operations which aims to shorten the systems development life cycle and provide continuous delivery with high software quality.

DevOps (development and operations) is an enterprise software development phrase used to mean a type of agile relationship between development and IT operations. The goal of DevOps is to change and improve the relationship by advocating better communication and collaboration between these two business units.

DevOps is a process framework that ensures collaboration between Development and Operations Team to deploy code to production environment faster in a repeatable and automated way. In simple terms, DevOps can be defined as an alignment between development and IT operations with better communication and collaboration.