Installing Terraform and Creating Compute Instance (Lab)

Installation of Terraform :

> Download .zip file from http://terraform.in and put that where you want on your system
> Unzip that file where you want to keep
> Set terraform path on your system so that it can read the path from where system will read terraform file
> Check by running terraform -v command

[osboxes@Controller terraform]$ export PATH=/home/osboxes/terraform/:$PATH
[root@Controller lab1]# terraform -v
Terraform v0.12.25

Creating a Compute Instance via Terraform (LAB)

1) Create an IAM user on you AWS console with any name and assign Admin Policy to that and downloaded CSV file which contains Secret Access Key and Secret Access Key

  • We will use above user (access and secret keys in provider) in terraform config file.

2) Now we will create directory structure like /terraform/Lab1 and in Lab1 directory we will create Terraform configuration files.

– I have created terra.tf file which will have my Provider and Resource configuration like below

3) Now we will initialize Terraform by below command :

4) Now we will run Terraform plan command to see what terraform wants to do :

5) Implement our tearraform code by terraform apply command like below :

6) Once the terraform apply is complete, login to your aws console and check your instances. You will find a new instance that would be launching like below :

Leave a Reply

Your email address will not be published. Required fields are marked *