Day64 ---> 90DaysOfDevOps Challenge @TWS

Day64 ---> 90DaysOfDevOps Challenge @TWS

Terraform with AWS

Provisioning on AWS is quite easy with Terraform.

Prerequisites

AWS CLI installed

The AWS Command Line Interface (AWS CLI) is a unified tool to manage your AWS services. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts.

image

AWS IAM User

IAM (Identity Access Management) AWS Identity and Access Management (IAM) is a web service that helps you securely control access to AWS resources. You use IAM to control who is authenticated (signed in) and authorized (has permissions) to use resources.

To connect your AWS account and Terraform, you need the access keys and secret access keys exported to your machine.

export AWS_ACCESS_KEY_ID="Your_User_Access_Key"
export AWS_SECRET_ACCESS_KEY="Your_User_Secret_Access_Key"

image

image

Or you can use aws configure command to enter your AWS credentials

image

Check whether you can access your AWS services remotely with awscli --->

image

Install required providers

terraform {
 required_providers {
        aws = {
        source  = "hashicorp/aws"
        version = "~> 4.16"
}
}
        required_version = ">= 1.2.0"
}

Add the region where you want your instances to be

provider "aws" {
region = "us-east-1"
}

Task: Provision an AWS EC2 instance using Terraform

Hint:

resource "aws_instance" "aws_ec2_test" {
    count = 2
    ami = "ami-08c40ec9ead489470"
    instance_type = "t2.micro"
    tags = {
        Name = "TerraformTestServerInstance"
    }
}

image

image

image

image

image

Happy Learning :)

Day 64 task is complete!

90DaysOfDevOps Tasks👇

github.com/Chaitannyaa/90DaysOfDevOps.git

Chaitannyaa Gaikwad | LinkedIn