Wednesday, October 24, 2018

Terraform On CentOS 7

Terraform On CentOS 7

Video URL :  https://www.youtube.com/watch?v=H2ucMryhIEk&index=6&list=PLxlXdZ1Dia3pC-gYbHOvH7KXdBQTUiodP

Video Title : Terra form Install in Linux [Ubuntu] | terraform tutorial


YouTube upload URL : https://www.youtube.com/watch?v=_MbXL2okf4A&t=0s&list=PLEiDY15kH-icds2AXozCQZ9FdF_B0U6Q2&index=10

YouTube upload Title : Terra form Install in Linux [Ubuntu] | terraform tutorial-by-NCD0318H019
Task 1 : Install Terraform in Centos 7
Step 1:
# Enter the below command to install zip and unzip
1
  sudo yum install -y unzip zip
Step 2:
#After installing zip&unzip Download the Terraform
1
   wget https://releases.hashicorp.com/terraform/0.9.8/terraform_0.9.8_linux_amd64.zip
Step 3:
#After downloading the terraform unzip the downloaded terraform zip file
1
    unzip terraform_0.9.8_linux_amd64.zip
Step 4:
#Move the Terraform to the /usr/local/bin location.
1
    sudo mv terraform /usr/local/bin
Step 5:
#Check the version of the terraform by using below command
1
terraform --version

************************************************************************************************

Video url : https://www.youtube.com/watch?v=5WykrpB7qS4&index=1&list=PLxlXdZ1Dia3pC-gYbHOvH7KXdBQTUiodP

Video Title : Terraform tutorial for beginners | deep dive of terraform | Infrastructure as Code

Youtube upload url : https://www.youtube.com/watch?v=H49LypLO8R4&index=12&list=PLEiDY15kH-icds2AXozCQZ9FdF_B0U6Q2

Youtube upload Title: Terraform tutorial for beginners | deep dive of terraform | Infrastructure as Code-by-NCD0318H019

Document URL: https://www.safaribooksonline.com/library/view/getting-started-with/9781788623537/

TASK 2: Create instance in AWS with Terraform
Solutions:
Step 1:
# Create an account in the Amazon Web Services(AWS) web
Step 2:
# Create the .tf config file in VM
1
vi conf.tf
# In the conf.tf file put the following configuration
provider "aws" {
access_key = "ACCESS_KEY_HERE"
secret_key = "SECRET_KEY_HERE"
region = "ap-south-1"
}

resource "aws_instance" "testserver" 
{
ami = "ami-d783a9b8"
instance_type = "t2.micro"
tags
{
Name="firstserver"
}
}
Step 3:
Initialize the terraform by using below command
1
terraform init
Step 4:
# After the succesful completion of the terraform initialization try run the below command to see the changes that are required for your infrastructure
1
terraform plan
Step 5:
#Run the following command to take the configurations we’ve written and use the AWS API to build our servers.
1
terraform apply
Step 6:
# After the terraform apply execute below command to see the state of the infrastructure.
1
terraform show
Step 7:
# Check if the instance is created or not in the AWS EC2 web console

*****************************************************************************************************
Video URL : https://www.youtube.com/watch?v=53X-HAw7BbA&index=4&list=PLxlXdZ1Dia3pC-gYbHOvH7KXdBQTUiodP

Video Title : Introduction to Infrastructure as Code ( IAC )

YouTube upload URL : https://www.youtube.com/watch?v=tECZEpzo3Lo&index=13&list=PLEiDY15kH-icds2AXozCQZ9FdF_B0U6Q2

YouTube upload Title:  Introduction to Infrastructure as Code ( IAC )-By- NCD0318H019

Document url : https://www.safaribooksonline.com/library/view/getting-started-with/9781788623537/

TASK 3: Creating VPC in AWS with Terraform
Solutions:
Step 1:
# Create .tf file in the VM
1
vi vpc.tf
# In the vpc.tf put the following configuration

provider "aws" {
access_key = "ACCESS_KEY_HERE"
secret_key = "SECRET_KEY_HERE"
region = "ap-south-1"
}
resource "aws_vpc" "main" {
cidr_block = "192.168.0.0/16"
instance_tenancy = "default"

tags {
Name = "main"
}
} 
resource "aws_subnet" "subnet" {
vpc_id = "${aws_vpc.main.id}"
cidr_block = "192.168.11.0/24"

tags {
Name = "subnet 1"
}
}
# In the above configuration access key and secret keys are you will get in AWS console when you add user
Step 2:
# After creating vpc.tf configuration file execute the below command to see the changes required for your infrastructure
1
 terraform plan
Step 3:
# After terraform plan run the below command to take configurations we’ve written and use the AWS API to build our servers.
1
     terraform apply
Step 4:
# After the completion of terraform apply execute the below command to see the state of the infrastructure
1
terraform show
Step 5:
# Check if the VPC is created or not in AWS web in the network and content delivery services

No comments:

Post a Comment