CREATING INFRASTRUCTURE USING
TERRAFORM

CREATING INFRASTRUCTURE USING TERRAFORM

WHAT IS TERRAFORM

Terraform is an open-source infrastructure as code software tool created by HashiCorp. It enables users to define and provision a datacenter infrastructure using a high-level configuration language known as Hashicorp Configuration Language (HCL), or optionally JSON.

  • NOW WE WILL SEE ABOUT BASIC STEPS BEFORE PERFORMING THE TASK:-
  1. FIRST WE NEED TO INSTALL THE TERRAFORM AND DECRYPT THE FILE.
  2. THEN WE NEED TO SETUP THE PATH FOR IT.
No alt text provided for this image

3. WE NEED TO HAVE THREE COMMANDS WHICH WILL BE IMPORTANT:-

A) TERRAFORM INIT

B)TERRAFORM APPLY

C)TERRAFORM DESTROY

QUES) CREATING OR LAUNCHING INFRASTRUCTURE USING TERRAFORM:-

STEPS TO BE FOLLOWED WHILE PERFORMING THE TASK:-

1. Create the key and security group which allow the port 80.

2. Launch EC2 instance.

3. In this Ec2 instance use the key and security group which we have created in step 1.

4. Launch one Volume (EBS) and mount that volume into /var/www/html

5. Developer have uploded the code into github repo also the repo has some images.

6. Copy the github repo code into /var/www/html

7. Create S3 bucket, and copy/deploy the images from github repo into the s3 bucket and change the permission to public readable.

8 Create a Cloudfront using s3 bucket(which contains images) and use the Cloudfront URL.

#PERFORMING THE TASK:-

BEFORE IT WE HAVE TO LOGIN USING THE PROVIDER BY GIVING REGION ID AND PROFILE NAME.

STEP-1 Create a key and security group with port number 80:

KEY: IT IS LIKE A PASSWORD FOR AUTOMATIC LOGIN IN TO THE CONSOLE.

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

STEP-2 AND 3:-LAUNCH EC2 INSTANCE AND LOGGING USING SECURITY GROUP AND KEY:-

No alt text provided for this image
No alt text provided for this image

STEP-4:-LAUNCHING THE VOLUME:-

No alt text provided for this image

STEP-4:- ATTACHING THE VOLUME:-


No alt text provided for this image

STEP-5 AND 6:CREATING THE S3 BUCKET AND STORING OBJECTS IN IT:-


No alt text provided for this image
No alt text provided for this image

STEP-7:CREATING CLOUD DISTRIBUTIONS:-

No alt text provided for this image
No alt text provided for this image

STEP-8:STORING THE FILE AND GIVIVNG OUTPUT COMMANDS:-

No alt text provided for this image

NOW LOOKING AT THE OUTPUT:-

No alt text provided for this image
No alt text provided for this image

NOW WE WILL DESTROY THE INFRASTRUCTURE:-

No alt text provided for this image
No alt text provided for this image


Keep up the good work 👍👍

To view or add a comment, sign in

More articles by Ankit Sagar

Others also viewed

Explore content categories