In this blog, we will see how we can automate our infrastructure deployment with Infra as Code Tools and what are good options we have .
So the first question comes in: What is Infrastructure as Code does and how it’s work?
Infrastructure as Code is IT Infrastructure management process of managing and provisioning cloud infrastructure management resources through machine readable definition files rather than physical hardware configuration or interactive configuration tools.
In fact we know doing things manually going through a web portal or installing things manually on Virtual Machines . Infrastructure as code helps to automate the process of deploying and configuring your infrastructure programmatically .
There are a couple of ways to automate your infrastructure deployment. It can be writing power-shell or bash scripts to some of the more complex infrastructures code tools but before going to deep dive of Infrastructure as Code let’s understand the difference between Infrastructure as Code and Configuration Management.
As mentioned above infrastructure as code and configuration management as code are not the same .It’s two different processes and we use the above given tools & components .
With cloud providers who provide specific ways for deploying infrastructure (using cloud provider portal manually) . If you want to find better ways to deploy resources on demand or you want to scale dynamically in that type of scenario infrastructure as code will be very helpful . It helps to automate your deployment process by maintaining the same standard in all DEV/QA/PROD environments . Below are given some Iac tools ,benefits and how we can start.
Third Party Iac Tools–
Terraform :- Terraform is a third part Iac tool provided by Harshi Corp. It focuses solely on creating, destroying and managing infrastructure components.
Major benefits to using terraform is for hybrid cloud environments. It allows you to automate infrastructure stacks from multiple cloud service providers simultaneously and integrate other third-party services. To start with terraform you can start with the tutorials below.
Other useful URLS:
Azure Provider –https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Azure Terraform Quickstarts – https://github.com/Azure/terraform/tree/master/quickstart
Getting Started With Terraform on AWS – https://spacelift.io/blog/terraform-tutorial
Pulumi : Pulumi is a third party Iac tool same as Terraform .It also supports multiple cloud resource deployment .
Major benefits with pulumi is for hybrid cloud environment and You can encrypt data inside management of state file .It also supports native language to write Iac script. you can write code in python ,c# and java.
Note :-Benefits with Third party Iac tools like Terraform are good for hybrid cloud deployment and it’s open source but It takes more time to deploy new features compared to cloud native Iac tools like Azure ARM Templates ,Cloud formation or Google cloud manager and you need to manage state files.
Cloud Native Iac Tools
Azure ARM Templates – Azure ARM Templates is one of the cloud native Infra as code tools to deploy infrastructure. You can define your cloud resources into json files.Then you deploy the files to the Cloud by running either Azure-CLI or PowerShell. Every JSON file is known as a template. A template contains your resources you want to deploy but it also contains different constructs that makes it easy to manage your resources as things get more complicated. Examples of such constructs are parameters, variables, template functions and outputs.
Google Cloud Deployment Manager : Google cloud deployment manager provides the same capabilities as ARM Templates for deploying resources .You can create and manage google cloud resources as a single unit using YAML or Python.
AWS Cloud Formation : AWS Cloud Formation is an IAC tool which provides you capabilities to deploy and manage resources on AWS. The models and Templates of AWS Cloud Formation are written in YAML or JSON format.
Note -: Microsoft provides the arm templates ,AWS provides Cloud Formation and GCP has their deployment manager . These are created directly by them and so these have the benefit of being supported by the cloud vendor . They get faster updates when new features are released compared to third party providers such as Terraform or Pulumi.
Which is best ?
If you plan to deploy complex applications in hybrid or multi-cloud ,expect to use both third party providers such as Terraform or Pulumi but if your all resources are with specific cloud providers then it’s best to go with cloud native IaC tools such as ARM Templates,Cloud Formation or Google Cloud Deployment Manager.
Some good channels/ tutorials to follow:
John Savil https://www.youtube.com/user/NTFAQGuy
Tim Warner- https://www.youtube.com/watch?v=eZK5ooO4JiM&list=PLYGZ9Q0oTOHcqclYTT4acGWpLrvjXh0Uj&ab_channel=TimWarner
Azure Friday : https://azure.microsoft.com/en-us/resources/videos/azure-friday/
Channel 9 https://channel9.msdn.com/
Azure top 10 resources YouTube video – https://www.youtube.com/watch?v=Mt2WSly9qBI&t=0s&ab_channel=MicrosoftAzure