Day-16 | Infrastructure as Code | #terraform #IaC

Abhishek.Veeramalla
26 Jan 202321:04

Summary

TLDRIn this 16th installment of the complete DevOps course, Abhishek introduces Infrastructure as Code (IaC), focusing on the challenges of managing cloud resources across different providers. He discusses the limitations of platform-specific IaC tools like AWS CloudFormation and Azure Resource Manager, and presents Terraform by HashiCorp as a universal solution that simplifies the process through API as code. The video promises a live demonstration of Terraform in the next session, aiming to clarify its advantages in a multi-cloud environment.

Takeaways

  • πŸ˜€ Abhishek introduces a dedicated video on Dynamic Inventory to address viewer doubts.
  • πŸ”„ The video focuses on 'Infrastructure as Code' (IaC), explaining its importance and use cases.
  • πŸ€” It discusses the problem of managing infrastructure across different cloud providers and the limitations of platform-specific tools like AWS CloudFormation Templates (CFT) and Azure Resource Manager.
  • πŸ›  The script highlights the need for a DevOps engineer to automate infrastructure creation, initially using AWS CLI or CFT, and then adapting to changes in cloud providers.
  • πŸ“š The concept of 'API as Code' is introduced, where Terraform is presented as a solution to the problem of learning multiple cloud provider-specific tools.
  • 🌐 Terraform's ability to interact with various cloud providers' APIs through a single scripting language is emphasized.
  • πŸ”§ The script explains how Terraform simplifies the process of migrating infrastructure from one cloud provider to another by making minimal changes to the scripts.
  • πŸ”„ It also touches on the hybrid cloud model, where organizations use multiple cloud services for different needs.
  • πŸ“ The importance of understanding APIs for automation is underscored, with a simple explanation of what an API is and how it works.
  • πŸ”‘ The video promises a follow-up session with live examples of Terraform, including installation and creating resources on AWS.
  • πŸ“ˆ The key takeaways from the script are the concepts of IaC and API as Code, and how Terraform leverages these to provide a unified approach to cloud infrastructure automation.

Q & A

  • What is the main topic discussed in the video script?

    -The main topic discussed in the video script is Infrastructure as Code (IaC) and the introduction of Terraform as a solution to manage IaC across different cloud providers.

  • What is the problem with managing infrastructure manually across different cloud providers?

    -Managing infrastructure manually across different cloud providers is problematic because it requires learning and using multiple tools specific to each provider, such as AWS CloudFormation Templates (CFT) and Azure Resource Manager, which can be time-consuming and inefficient.

  • What is a Compute Resource as mentioned in the script?

    -A Compute Resource, as mentioned in the script, refers to hardware resources like CPU and RAM, which can be created on any cloud platform or on-premises.

  • What does the script suggest as an alternative to learning multiple IaC tools for different cloud providers?

    -The script suggests Terraform as an alternative to learning multiple IaC tools, as it allows DevOps engineers to write scripts that can automate infrastructure across any cloud provider using a single tool.

  • What is the significance of the term 'API as code' in the context of Terraform?

    -The term 'API as code' in the context of Terraform refers to the concept where Terraform scripts are used to interact with the APIs of cloud providers, abstracting the need to write direct API calls.

  • What is the role of Terraform in automating infrastructure across multiple cloud providers?

    -Terraform's role in automating infrastructure across multiple cloud providers is to act as an intermediary that translates Terraform scripts into API calls that the respective cloud provider can understand and execute.

  • What is the concept of a Hybrid Cloud Model as discussed in the script?

    -The concept of a Hybrid Cloud Model, as discussed in the script, is where an organization hosts part of its infrastructure on one cloud provider and another part on a different cloud provider, leveraging the strengths of each.

  • What is the advantage of using Terraform over specific IaC tools for individual cloud providers?

    -The advantage of using Terraform over specific IaC tools for individual cloud providers is that it simplifies the learning curve and migration process, as it can handle automation across different providers with minimal changes to the scripts.

  • What is the difference between Infrastructure as Code (IaC) and Terraform?

    -Infrastructure as Code (IaC) is a broader concept where infrastructure is defined and managed using code, which can be done with various tools like AWS CFT or Azure Resource Manager. Terraform, on the other hand, is a specific tool that implements IaC and adds the capability to interact with multiple cloud providers' APIs through a single scripting language.

  • What is the script's stance on the complexity of managing IaC without a tool like Terraform?

    -The script's stance is that managing IaC without a tool like Terraform can be complex and inefficient due to the need to learn and use multiple specific tools for different cloud providers, which can lead to wasted effort and time.

  • What is the purpose of the video script's explanation of API in the context of Terraform?

    -The purpose of the video script's explanation of API in the context of Terraform is to clarify how Terraform uses APIs to communicate with cloud providers, allowing for automation without the need for direct API call scripting.

Outlines

00:00

πŸ‘‹ Introduction to DevOps and Infrastructure as Code

In this introductory paragraph, Abhishek, the host of the channel, welcomes viewers back and outlines the agenda for the day. He briefly recaps the previous lessons on configuration management and Ansible, addressing the audience's request for a dedicated video on Dynamic Inventory. The main focus for the current session is Infrastructure as Code (IaC). Abhishek explains the importance of understanding the problem before exploring the solution, which includes the use cases and the concept of IaC. He uses the example of a DevOps engineer at Flipkart to illustrate the challenges and processes involved in managing compute resources across various platforms like AWS, Azure, and on-premises.

05:02

πŸ›  The Challenge of Multi-Cloud and Hybrid Infrastructures

This paragraph delves into the complexities faced by DevOps engineers when managing infrastructure across multiple cloud providers or hybrid environments. Abhishek discusses the limitations of provider-specific tools like AWS CloudFormation Templates (CFT) and Azure Resource Manager, which necessitate rewriting scripts when migrating infrastructure from one provider to another. He highlights the impracticality of learning and using multiple tools for different cloud providers and introduces the concept of a hybrid cloud model, where organizations may host parts of their infrastructure on different platforms based on specific needs or cost benefits.

10:03

🌐 Introducing Terraform and API as Code

Abhishek introduces Terraform, a tool developed by HashiCorp, as a solution to the problem of managing infrastructure across multiple cloud providers without learning multiple tools. Terraform operates on the concept of API as Code, allowing DevOps engineers to write scripts that Terraform then translates into API calls for the respective cloud provider's API. This approach simplifies the process of automating infrastructure, as it abstracts the need to interact directly with each provider's API. The paragraph also discusses the benefits of Terraform in terms of reducing the learning curve and streamlining the migration process between cloud providers.

15:05

πŸ”— Understanding APIs and Terraform's Role in Automation

In this segment, Abhishek clarifies what an API (Application Programming Interface) is and how it facilitates programmatic communication with applications. He uses Google as an example to explain how APIs can be used to retrieve information without the need for manual interaction through a user interface. The paragraph further explains how Terraform leverages APIs to automate infrastructure provisioning across different cloud providers, thereby simplifying the process for DevOps engineers and reducing the need for multiple specialized tools.

20:07

πŸ“š Wrapping Up and Previewing Future Lessons

To conclude the video script, Abhishek summarizes the key concepts discussed, namely Infrastructure as Code (IaC) and API as Code. He emphasizes the utility of Terraform as a unified language for infrastructure automation across various cloud platforms. Abhishek invites viewers to provide feedback and questions, especially if they need further clarification on certain topics. He also encourages viewers to like, comment, and subscribe to the channel for more educational content, promising a future video with live examples and a project using Terraform.

Mindmap

Keywords

πŸ’‘DevOps

DevOps refers to a set of practices that automate and integrate the processes between software development and IT teams, allowing for more efficient and reliable software deployment. In the video, the speaker is a DevOps engineer who is responsible for automating infrastructure processes, which is central to the theme of the video.

πŸ’‘Infrastructure as Code (IaC)

Infrastructure as Code is a DevOps concept where infrastructure is defined in a script format that can be version-controlled and automated. In the video, IaC is discussed as a means to manage and provision cloud resources like AWS EC2 instances, S3 buckets, and RDS databases using code rather than manual processes.

πŸ’‘Dynamic Inventory

Dynamic Inventory is a feature in configuration management tools like Ansible that allows for the real-time discovery of infrastructure resources. The speaker mentions that they will make a dedicated video to clear doubts about dynamic inventory, indicating its importance in managing cloud resources.

πŸ’‘AWS CLI

AWS CLI stands for Amazon Web Services Command Line Interface, a tool that allows users to interact with AWS services through the command line. In the script, the speaker uses AWS CLI as an example of automating the creation of AWS resources.

πŸ’‘AWS CloudFormation Templates (CFT)

AWS CloudFormation Templates are JSON or YAML files that describe all the resources needed for an application in AWS. The speaker mentions using CFTs to automate infrastructure on AWS, which is a key part of the Infrastructure as Code concept discussed in the video.

πŸ’‘Hybrid Cloud

A Hybrid Cloud refers to a computing environment that combines on-premises, private cloud, and third-party, public cloud services. The video discusses the concept of Hybrid Cloud, where organizations like Flipkart might host part of their infrastructure on AWS and part on Azure, to leverage the best of both worlds.

πŸ’‘API as Code

API as Code is the practice of using code to interact with APIs programmatically, allowing for automation and integration of services. The video explains how Terraform, a tool introduced in the script, uses API as Code to automate infrastructure across different cloud providers without needing to learn their specific scripting languages.

πŸ’‘Terraform

Terraform is a tool developed by HashiCorp that enables users to build, change, and version infrastructure safely and efficiently using a single consistent workflow. The speaker explains that Terraform addresses the problem of having to learn multiple tools for different cloud providers by using a single tool that interacts with their APIs.

πŸ’‘Azure Resource Manager

Azure Resource Manager is a service in Azure that enables users to create, update, and delete resources in a controlled and manageable way. The video script mentions the need to convert AWS CFT scripts to Azure Resource Manager templates when migrating infrastructure from AWS to Azure.

πŸ’‘OpenStack

OpenStack is an open-source cloud operating system that supports all types of clouds, from public and private to hybrid. In the video, the speaker describes using OpenStack to create a private cloud infrastructure, which is then automated using Heat templates.

πŸ’‘Heat Templates

Heat Templates in OpenStack are used to orchestrate the deployment of infrastructure by defining a stack of AWS-like resources. The speaker mentions migrating scripts to Heat templates when moving from cloud providers like AWS and Azure to an on-premises OpenStack environment.

Highlights

Introduction to a dedicated video on Dynamic Inventory to clear doubts.

Exploration of Infrastructure as Code (IaC) and its importance in DevOps.

Understanding the problem with manual creation of compute resources across different platforms.

The role of a DevOps engineer in managing infrastructure for a company like Flipkart.

Different options for compute resource deployment, including cloud platforms and on-premises.

Automation of AWS infrastructure using AWS CLI and CloudFormation Templates (CFT).

Challenges faced when migrating infrastructure scripts from AWS to Azure due to vendor lock-in.

The concept of hybrid cloud and its adoption in organizations for flexibility.

Explanation of the shift from AWS to Azure and the need to rewrite automation scripts.

Introduction to Terraform as a solution to the problem of learning multiple IaC tools.

Terraform's ability to abstract away the complexities of different cloud provider APIs.

The smooth transition between cloud providers facilitated by Terraform's API as code approach.

Terraform's role in reducing the effort required to migrate infrastructure across cloud providers.

Explanation of API as code, allowing automation of any provider's infrastructure through their APIs.

Terraform's use of API as code to communicate with cloud provider APIs, simplifying the process for DevOps engineers.

Upcoming live examples and a project using Terraform to demonstrate its practical application.

Learning outcomes from the video, including Infrastructure as Code (IaC) and API as code concepts.

Invitation for feedback and questions from viewers to improve the content and understanding.

Transcripts

play00:01

hello everyone my name is Abhishek and

play00:04

welcome back to my channel so today we

play00:06

are at day 16 of our complete devops

play00:08

course in the previous classes we talked

play00:10

about configuration management we talked

play00:11

about ansible and yeah I know few of you

play00:14

have uh doubts with respect to Dynamic

play00:16

inventory that is something that we did

play00:18

not talk in the previous class so with

play00:21

your request what I've decided is yeah

play00:23

I'll make a completely dedicated video

play00:25

on Dynamic inventory and I'll make sure

play00:27

that all your doubts are cleared but for

play00:29

today we'll be talking about

play00:31

infrastructure as code okay so today's

play00:34

topic is infrastructure as code and in

play00:36

today's class we'll completely talk

play00:38

about the theory part uh by Theory I

play00:40

mean to say we'll try to understand what

play00:42

is the problem right because first of

play00:45

all we need to understand what is the

play00:46

problem and then we will see what are

play00:48

the use cases

play00:52

and finally we'll try to understand what

play00:54

is the solution okay

play00:56

so without wasting any time let's

play00:58

quickly start the video and try to

play01:00

understand infrastructure as code

play01:02

now let's say that you are a devops

play01:05

engineer okay so you are a devops

play01:07

engineer who is working for an

play01:09

organization called uh let's say

play01:11

Flipkart okay

play01:14

so you're working for a Flipkart

play01:19

so Flipkart as a company they can create

play01:22

their compute resources anywhere right

play01:24

so what is a compute resource compute

play01:25

resource is nothing but uh CPU Ram or

play01:29

you know any other Hardware resources

play01:30

they can create on any of the cloud

play01:33

platform or they can also create on

play01:35

their on-premises that is Flipkart has

play01:38

let's say 300 applications okay so to

play01:40

deploy these 300 applications they would

play01:42

need servers because servers is a player

play01:44

where you deploy your applications and

play01:46

expose to the customers now Flipkart can

play01:49

deploy these applications on different

play01:51

options like they can deploy these

play01:53

applications on AWS

play01:55

or they can deploy these applications on

play01:57

azure

play02:00

Google Cloud platform or they can also

play02:03

deploy it on their physical servers that

play02:05

is on-premises right

play02:08

and there are a bunch of other options

play02:09

these are not only the four options okay

play02:11

this can exceed like you know you have

play02:13

Oracle Cloud you have digital ocean

play02:15

hundreds of options are there so as a

play02:18

devops engineer let's say you have

play02:19

decided that okay you evaluated all of

play02:21

these things and you said that okay

play02:23

so Flipkart will host all of their

play02:25

infrastructure on AWS okay so let's say

play02:28

as a devops engineer you have taken this

play02:30

decision and this decision went very

play02:32

well and what you have done is you know

play02:34

you started to create servers on like it

play02:37

can be easy to instances or it can be S3

play02:40

buckets okay or it can be RDS database

play02:43

all of these resources are required for

play02:45

your organization and as a good devops

play02:48

engineer what you have done is you have

play02:49

automated the entire process on AWS like

play02:52

instead of creating manually through the

play02:54

console what you have decided is you

play02:56

will use the AWS CLI okay or you can

play03:00

also use something like AWS cloud

play03:01

formation templates okay CFT let's say

play03:04

cloudformation templates as CFT so in

play03:07

the previous class when we talked about

play03:08

AWS automation I already mentioned you

play03:10

like there are multiple options you can

play03:12

use AWS CLI you can use AWS CFT you can

play03:15

use uh you know AWS cdk many options

play03:18

right

play03:19

so as a devops engineer you decided that

play03:22

your organization will use AWS cloud

play03:24

formation templates okay so what we have

play03:26

done is you have used AWS cloud

play03:30

formation templates which is called as

play03:31

CFT and you have automated the

play03:35

infrastructure on AWS Cloud platform

play03:37

okay so let's say this is AWS cloud and

play03:40

you have what you have you done you have

play03:43

automated this stuff

play03:47

so any developer who comes to you and

play03:50

tells you okay Abhishek I want

play03:53

10

play03:55

ec2 instances so what you'll do you'll

play03:57

say that yeah using cfts I already wrote

play04:00

the script now I just need to execute

play04:02

the CFT script for ec2 instances and you

play04:04

have 10 ec2 instances will be generated

play04:06

in no time similarly somebody comes to

play04:08

it with S3 buckets everything okay so

play04:11

you wrote some hundreds of scripts okay

play04:13

so you wrote some hundreds of scripts

play04:15

and all these hundreds of scripts are

play04:17

stabilized and your work is going pretty

play04:19

well okay now you don't have any

play04:21

problems but what happened all of a

play04:23

sudden is your AWS okay the decision

play04:27

that you take in okay AWS your

play04:29

management said that okay we were using

play04:31

AWS till date but due to some reasons

play04:33

like you know you are not happy with the

play04:34

AWS support or you know the costing that

play04:37

AWS is uh you know the cost that AWS is

play04:41

uh giving to you you are not happy with

play04:43

it so what you have decided is you will

play04:45

shift from AWS to Microsoft azure okay

play04:49

so what have you decided from AWS you

play04:52

want to move to Microsoft Azure now all

play04:55

these hundreds of scripts that you have

play04:56

written will be of no use because again

play04:59

if some developer comes to you and says

play05:02

that Abhishek I would need 10 virtual

play05:05

machines on your Azure platform okay so

play05:08

you cannot say that I have written CFT

play05:10

you can use the CFT because CFT is very

play05:12

specific to your AWS cloud provider

play05:15

right so CFT only belongs to your AWS

play05:18

cloud provider

play05:20

so again you have to put all the effort

play05:23

and you have to migrate this hundreds of

play05:25

scripts into Azure resource manager like

play05:27

similar to AWS CFT as your support

play05:30

something called as Azure resource

play05:32

manager okay so you put a lot of effort

play05:35

and again you converted the hundreds of

play05:37

scripts into Azure resource manager and

play05:39

you have again automated the entire

play05:41

process okay let's say you have again

play05:44

automated the entire process now what

play05:47

your organization said is okay whether

play05:50

it is Flipkart or any organization said

play05:51

okay we moved to Azure as well and we

play05:54

were not even happy with Azure okay so

play05:56

again the support with Azure is not good

play05:58

or you know you are not happy with the

play06:00

costing so you wanted to move from Azure

play06:02

this time you want to move to on-premise

play06:05

okay so that means you want to maintain

play06:08

your own infrastructure okay so on

play06:11

premise so what you have done is you

play06:13

purchase your own servers and on top of

play06:16

the servers you used openstack okay

play06:18

openstack is used to create your own

play06:21

cloud okay so you created your entire

play06:25

Data Center and on the data center you

play06:26

installed openstack okay and you have

play06:29

decided that okay anybody who comes with

play06:31

a request for 10 VMS or 20 VMS or you

play06:33

know for any kind of request we will say

play06:35

that okay we have on-premise and we have

play06:38

installed openstack so you will get it

play06:40

but for that reason what you need to do

play06:42

is you have to again migrate these

play06:45

scripts okay that worked firstly on AWS

play06:47

CFT now you migrated them to Azure

play06:50

resource manager and now you have to

play06:51

migrate them to heat templates

play06:54

okay so heat templates is a way how

play06:57

openstacks automates the process okay so

play06:59

if you want to automate any

play07:01

infrastructure on uh openstack you will

play07:03

use something called as key templates so

play07:06

again you waste a lot of time and you

play07:07

migrated the entire thing to heat

play07:09

templates so this was the process that

play07:11

was going on and you know this is just

play07:14

an example these days what usually

play07:16

companies are doing is they are usually

play07:18

operating in hybrid Cloud Model okay so

play07:21

what is hybrid Cloud Model so any

play07:24

organizations okay depending upon the

play07:26

requirements what they can do is they

play07:28

can host part of their infrastructure on

play07:31

AWS and part of their infrastructure on

play07:34

Azure now why is this happening this is

play07:36

because okay this was scenario number

play07:39

one okay so what I explained you here

play07:41

this is scenario number one and in

play07:43

scenario number two there is another

play07:45

option that people are moving to hybrid

play07:48

Cloud okay so what is hybrid Cloud

play07:50

hybrid cloud is a way using which you

play07:53

can create part of your infrastructure

play07:55

on AWS and part of your infrastructure

play07:57

on Azure that is because let's say AWS

play07:59

is giving you good offers or you know

play08:01

AWS is giving you good support with

play08:04

respect to the uh let's say for example

play08:07

it is giving good support with respect

play08:08

to the storage Services okay so for

play08:10

storage Services you have decided to use

play08:12

AWS and for devops related services for

play08:16

the build related services or you know

play08:17

for the

play08:18

um

play08:20

the project management related Services

play08:22

you want to use Azure devops okay so for

play08:24

devops you want to use Azure and for the

play08:27

build or sorry for the storage related

play08:29

Services you want to use AWS this is

play08:31

because AWS is good with the storage

play08:33

Services just an example and Azure is

play08:35

good with the

play08:37

uh devops related services so your

play08:40

organization that is Flipkart has

play08:42

decided to go with this hybrid Cloud

play08:44

architecture okay so now as a devops

play08:47

engineer what you need to do is you need

play08:49

to learn both

play08:52

okay so you need to learn both AWS CFT

play08:54

for writing the automation on AWS and

play08:58

you need to learn Azure resource manager

play09:01

for automating stuff on Azure and this

play09:04

problem can vary from organization to

play09:06

organization and also team to team uh

play09:09

you know there might be some secure

play09:10

Services even for a Flipkart where you

play09:13

know you don't want to use AWS you don't

play09:14

want to use Azure and you want to use

play09:16

on-premise okay so again for that reason

play09:18

you have to write heat templates or

play09:19

something so to avoid all these problems

play09:22

okay to solve the problem of learning

play09:24

too many things okay to instead of uh I

play09:28

just gave you an example with two

play09:29

infrastructure resources that is two

play09:31

Cloud providers that is AWS and Azure

play09:33

this problem can go can grow leaps and

play09:36

bonds right there can be hundreds of

play09:38

cloud providers as a devops engineer

play09:39

which tool will you learn so to solve

play09:41

this problem what people have come with

play09:44

is terraform okay so who is addressing

play09:48

this problem terraform and the concept

play09:51

here is

play09:54

API

play09:57

as code okay

play10:00

so what all of the previous tools were

play10:03

called so here for example AWS CFT or

play10:06

Azure resource manager they were all

play10:08

called as infrastructure as code because

play10:10

you are writing your infrastructure as

play10:12

code but the problem there was even you

play10:15

are writing your infrastructure as code

play10:17

you know you are not manually creating

play10:19

the resources you are creating the

play10:21

infrastructure using Code so that was

play10:23

good but the problem was in the world of

play10:26

hybrid cloud and in the world of

play10:27

multiple crowd providers so you cannot

play10:30

solve the problem with different

play10:31

different options like you know AWS CFT

play10:34

Azure resource manager you have to learn

play10:36

hundreds of tools so terraform came who

play10:38

is terraform terraform is a tool that is

play10:40

developed by hashicor

play10:42

okay so hashikov came ahead and said

play10:46

that okay devops engine is don't learn

play10:48

hundreds of tools okay so they said

play10:50

devops Engineers that instead of

play10:52

learning hundreds of tools just learn

play10:54

one tool and that tool is called as

play10:56

terraform okay now will telephone solve

play10:59

all your problems or not that is uh you

play11:01

know I'll explain you there are some

play11:02

problems with terraform as well in the

play11:04

future videos or I already created a

play11:06

video on my Channel with respect to

play11:07

terraform but the main purpose of

play11:10

terraform is to solve the problem of

play11:12

learning too many tools or you know

play11:14

execution of too many tools now

play11:16

terraform K header came ahead and said

play11:18

that

play11:19

okay if you are a devops engineer what

play11:21

you can do is basically you can create

play11:24

terraform scripts okay so write some

play11:29

terraform Scripts

play11:31

and terraform what it will basically do

play11:34

is terraform will take care of

play11:36

automating the resources whether it is

play11:38

AWS whether it is azure whether it is uh

play11:41

like you know

play11:43

let's say this is AWS this is azure

play11:47

and this is gcp okay so as a devops

play11:50

engineer what you need to do is you need

play11:52

to write the terraform scripts and

play11:54

terraform will take care of automating

play11:56

the resources on the cloud provider so

play11:58

you just need to tell the terraform that

play12:00

okay my provider is AWS

play12:03

okay so once you say that my provider is

play12:05

AWS so terraform will say that okay uh

play12:08

give me the scripts for AWS and I can

play12:10

automate the stuff related to AWS now

play12:12

you might ask me okay so the problem is

play12:14

the same even now if you want to migrate

play12:16

from One Cloud provided to other cloud

play12:18

provider you just have to modify I mean

play12:21

you you still need to modify the

play12:22

terraform scripts right so in the

play12:24

previous slides I explained you that

play12:27

if you want to move from one cloud

play12:29

provider to the another cloud provider

play12:31

the problem is that you have to migrate

play12:33

your scripts but within terraform what

play12:35

terraform tells you is that the

play12:37

migration is very smooth like your

play12:39

organization if it decides to migrate

play12:41

from AWS to Azure you need to make some

play12:44

minimum changes like you know you need

play12:45

to update some modules or uni you know

play12:47

you need to update the provider details

play12:49

and once you do that you know you can

play12:52

easily migrate from AWS to Azure okay so

play12:55

this is how terraform solves the problem

play12:57

and the other thing is instead of

play12:59

learning too many tools okay so you

play13:01

don't have to learn about AWS CFT you

play13:03

don't have to learn about Azure resource

play13:05

manager and again uh you know heat

play13:07

templates or XYZ tools you can learn

play13:09

just one tool and this one tool can take

play13:13

care of creating new modules for you and

play13:15

you know just looking at the terraform

play13:16

documentation you can write automation

play13:19

for any infrastructure so this concept

play13:22

is called as API as code

play13:24

okay so what is apis code so API as code

play13:29

is a concept using which you can

play13:31

automate any provider whether it is AWS

play13:34

Azure or openstack anything using their

play13:36

apis okay so what terraform does

play13:39

internally is terraform will talk to the

play13:41

API of azure terraform will talk to the

play13:43

API of gcp or terraform will talk to the

play13:47

API of openstack so using which like you

play13:50

know you don't have to write any code so

play13:52

once you write the terraform templating

play13:54

or you write the terraform script files

play13:55

terraform will convert them depending

play13:58

upon the provider details that you have

play13:59

provided so in one of the files called

play14:01

provider.tf you say that the provider is

play14:04

AWS so once you write the terraform

play14:06

module terraform will convert that

play14:07

script into AWS readable API okay or the

play14:11

API request that AWS can understand and

play14:14

it executes the action and gives you the

play14:16

result back okay so this is how

play14:18

terraform is one tool that can automate

play14:21

your resources on any cloud provider

play14:24

Okay so this is a concept of API as code

play14:27

now when I explained a similar Concept

play14:29

in the last class many people were

play14:31

asking me what is API

play14:34

okay so many people did not understand

play14:36

what is API so let me take a moment and

play14:39

explain you what is API so API is

play14:41

nothing but application

play14:46

interface okay so basically using API

play14:50

you can talk to any application and you

play14:53

can get the response back for example

play14:55

okay let's take a basic example you want

play14:57

to talk to Google

play14:59

okay so what is the usual process you

play15:02

open your laptop okay you open your

play15:05

laptop and on your laptop you will open

play15:07

your favorite browser and you will type

play15:08

www dot google.com Okay so once you type

play15:13

this what happens is you send your

play15:15

request to Google and you get a browser

play15:18

page and on the browser page you can

play15:20

search the information related to Google

play15:22

so this is basically a user interface

play15:25

right so this is a way how you manually

play15:27

do things but whenever you want to

play15:30

automate things or you know whenever you

play15:31

want to do things programmatically so

play15:33

this way is not suitable right because

play15:36

let's say you want to get some

play15:37

information from Google in a

play15:39

programmatical manner okay so instead of

play15:41

logging into your laptop instead of you

play15:43

know opening the browser and getting the

play15:45

information from Google what you want to

play15:47

do is you just want to run a script okay

play15:50

and this script will talk to the Google

play15:52

okay this script will talk to Google and

play15:55

it executes the action and sends you the

play15:57

result back

play15:59

to perform this kind of things what

play16:01

developers have come okay whether it is

play16:03

Google or whether it is uh Argo CD or

play16:06

whether it is any application what

play16:07

developers have done is they have come

play16:09

up with a concept called API okay so

play16:11

using API you can programmatically talk

play16:14

to any applications so whether it is

play16:16

GitHub whether it is Google whether it

play16:18

is uh Flip Flip I don't know if Flipkart

play16:21

has an API sorry or any other

play16:22

applications what they will do is Google

play16:25

GitHub will expose their API okay so

play16:27

GitHub will tell you that okay instead

play16:30

of manually logging into GitHub

play16:32

authenticating with me and you know

play16:34

opening your browser and going through

play16:35

the flows what you can do is you can

play16:37

open your terminal okay once you open

play16:40

the terminal you can use a curl request

play16:42

or you know you can use a HTTP get

play16:44

request and using this HTTP get request

play16:47

or curl request you can talk to my API

play16:49

and get whatever information that you

play16:51

want and I'll send you the result

play16:54

right so this way you can talk to any

play16:57

applications programmatically using the

play16:59

apis okay so that is the only difference

play17:01

either you manually talk to the

play17:03

applications using the user interface or

play17:05

you talk to the applications using a

play17:07

programmatic interface so the

play17:08

programmatic interface in this case is

play17:10

called as API that's the concept of API

play17:13

now terraform uses the same concept okay

play17:15

what terraform does is terraform AWS has

play17:19

their own API okay and Azure has their

play17:21

own API what terraform has done is

play17:23

instead of okay instead of developers

play17:26

directly talking to the apis because if

play17:29

you want to talk to the apis you need to

play17:30

know some programming language okay

play17:31

sometimes get requests are easy but you

play17:34

know you might want to create resources

play17:35

on it and you might want to make some

play17:36

post calls so instead of you writing

play17:39

this calls in python or shell scripting

play17:41

what terraform said is that okay we'll

play17:43

actively look at this apis

play17:45

okay

play17:48

terraform will actively look at this

play17:50

apis and terraform has written their own

play17:53

modules or terraform has come across

play17:56

let's say you want to create an ec2

play17:57

instance on AWS so terraform said that

play18:00

instead of you directly making API call

play18:02

with AWS you can write some terraform

play18:04

file okay and in this terraform file you

play18:07

can go through the terraform

play18:07

documentation which will definitely do

play18:09

tomorrow so terraform will tell you that

play18:12

okay there is a module called ec2 and

play18:14

using this ec2 module you just write

play18:16

bunch of lines just like you write in

play18:18

English and what we will do is once user

play18:21

submits this request okay in terraform

play18:23

file once you do this uh terraform will

play18:26

receive this request and it will take

play18:28

your input and it will convert your

play18:30

input into API call

play18:33

okay this is happening at the back end

play18:35

terraform will convert your request into

play18:37

API call and it gets the request back

play18:40

and again terraform will send you the

play18:41

request back to you so as a user you are

play18:44

not directly talking to the apis of AWS

play18:46

and Azure but you are writing terraform

play18:49

scripts and terraform is converting your

play18:51

request into API calls okay so this is

play18:53

concept of terraform and this is how

play18:56

terraform utilizes the concept called

play18:58

API

play19:00

as code

play19:02

so in tomorrow's class we will see

play19:04

terraform live examples and you know we

play19:07

will see a live project using terraform

play19:09

we'll start with the installation we'll

play19:11

try to create ec2 instances or any

play19:14

specific stack on AWS and I'll show you

play19:17

how exactly terraform works so what did

play19:19

we learn today we learned about two two

play19:21

concepts one is infrastructure as code

play19:24

right IAC

play19:27

and we talked about API as code

play19:32

so infrastructure as code is a concept

play19:35

using which

play19:37

okay so infrastructure as a code is a

play19:39

concept using which you can automate

play19:41

your infrastructure

play19:43

so it can be anything like you know you

play19:45

can write your cloud formation templates

play19:47

or you can write your Azure resource

play19:48

manager or anything so all of these

play19:50

things fall into the category of

play19:53

infrastructure as code whereas terraform

play19:56

is a concept which is used to solve all

play19:58

of these problems like you know

play19:59

terraform also works on the same concept

play20:01

of infrastructure as code but terraform

play20:04

has advanced capabilities called API as

play20:06

code right instead of you writing all of

play20:09

these things terraform says that okay

play20:11

just learn one language instead of

play20:13

learning uh AWS uh cloud formation

play20:16

templates Azure resource manager just

play20:18

learn one language that is called as

play20:19

terraform and terraform will take care

play20:21

of talking to all of those Cloud

play20:23

providers using the concept of API as

play20:25

code I hope you understood the concept

play20:28

well and if you have any questions

play20:30

please provide me the timestamp and tell

play20:32

me okay Abhishek I did not understand

play20:34

the concept here so that I can make a

play20:36

Youtube short video or you know if it is

play20:38

possible I can also explain you in the

play20:39

comment section okay so this is a

play20:41

concept which you did not understand and

play20:43

uh yeah your feedback will definitely

play20:45

help me to improve as well so if you

play20:48

like the video click on the like button

play20:49

and if you have any questions not not

play20:51

just about today's class even in the

play20:53

previous classes do post them in the

play20:55

comment section and finally don't forget

play20:58

to subscribe to our Channel if you

play21:00

haven't I'll see in the next videos

play21:01

thank you so much take care everyone

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
DevOpsInfrastructureTerraformCloudAWSAzureAutomationAPIsScriptingHybrid Cloud