Professional Documents
Culture Documents
DevOps Training - Project - Automating Infrastructure Using Terraform
DevOps Training - Project - Automating Infrastructure Using Terraform
Automating
Infrastructure
using Terraform
PG DO - DevOps
Akshay 01-Oct-2023
Certi caion
1
fi
Automating Infrastructure using Terraform
Contents
1. Introduction to the Project …………………………………….. 3
5. Conclusion ……………………………………………………… 17
2
Automating Infrastructure using Terraform
1. Introduction
3
Automating Infrastructure using Terraform
1. Pre-requisites
1.1. Install Terraform
Terraform is installed and the version installed can be seen by using the
command
terraform —version
1.2. Create user with admin access and create access key and secret
access key
Open the AWS account and select IAM (Identity Access Management) and under
users, click on Create user and create user with administrator permissions as seen
below.
4
Automating Infrastructure using Terraform
Once the user is created, select the user and go to security credentials tab and
create access key and secret access key
5
Automating Infrastructure using Terraform
Open the terminal in your machine and create a directory and move into the
directory
mkdir project1
cd project1
Create a terraform le and enter the region, access key and secret key as seen
below
vi ec2.tf
6
fi
Automating Infrastructure using Terraform
Now to the same le add the resources of the instance like the AMI ID, instance
type and instance name as seen below
7
fi
fi
Automating Infrastructure using Terraform
Press :wq and save the le to exit and come out of the le
terraform init
8
fi
fi
Automating Infrastructure using Terraform
terraform plan
9
Automating Infrastructure using Terraform
You can see in the below screenshot that the apply is complete and instance is
created.
You can verify the creation of instance by going to the AWS account. You can see
that the instance with the same name Project-machine is created
10
Automating Infrastructure using Terraform
Select the created instance and click on the connect button on the top. On the
next screen click on Connect button.
11
Automating Infrastructure using Terraform
sudo su
apt update -y
apt install python3 -y
12
Automating Infrastructure using Terraform
apt update -y
Install Jenkins
13
Automating Infrastructure using Terraform
14
Automating Infrastructure using Terraform
4. Project Results
1. An EC2 instance was created using Terraform
15
Automating Infrastructure using Terraform
16
Automating Infrastructure using Terraform
5. Conclusion
Results shown in the previous section is evidence that the EC2 instance was
created using Terraform.
17