Blog 9 Sp21
#Blog 9-SP21
Terraform
This blog post is about the wonderfully amazing tool known as Teraform. After a lecture and a few google searches, I understand Terraform to be an open source infrastructure as code software tool, by HashiCode. Terraform uses HCL, HashiCorp Configuration Language, and\or JSON.
Terraform essentially is a configuration management tool for external “resources”. These resources coould be something along the lines of a public cloud infrastructure, private cloud infrastructure, platform as a service, and\or software as a service. It supports a number of Cloud Service Providers such as Amazon Web Services, Microsoft Azure, VMware, Google Cloud, IBM Cloud, and\or etc. And because it’s used for so many service providoers it is quite essential for anyone in the business of managing any form of cloud infrstructure.
If It Ain’t Broke, Don’t Fix It. Unless It Makes It More Efficient.
Previously, to make any configurtations to a server you’d have to SSH into each machine. That takes up precious time. And the reality is that time is money. Terraform allows you to write out code that will define, “provision” your infrastructure. You can automate provisioning and deployment processes, use version control to help debug issues in your infrastrucuture. And so many more things.
A Little Technical Mini-lab | How To Create an AWS instance in Terraform
For this you can use any text editor you’d like. I like Visual Studio, just cause my professor uses it. Before we go any further, I’m going to assume you already have the application downloaded.
- Begin with creating a file called “main.tf” and put this little snippet of code into the file.
provider “aws” { region = “us-east-2” }
- Attach an AWS instance
resource “aws_instance” “example” { ami = “ami-0c55rtyun56e1f0” instance_type = “t2.micro” }
- Move into the folder where main.tf is saved and run the command below. This will scan for the “provider” that you are using.
terraform init
- Then to create that instance…
terraform apply
- Boom. You’ve made you’re instance/serve