DevOps(Day-83): Terraform with AWS - Part1

 

  • Prerequisites

    • AWS CLI installed

    • AWS IAM user

Provisioning on AWS is quite easy with Terraform.

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.

  • Install AWS CLI on the Ubuntu server.

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.

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

COPY

COPY

export AWS_ACCESS_KEY_ID=<access key>
export AWS_SECRET_ACCESS_KEY=<secret access key>
  • Create an IAM user with suitable permissions.

  • Export the access keys to configure aws console to terminal through awscli

COPY

COPY

Explainterraform {
 required_providers {
        aws = {
        source  = "hashicorp/aws"
        version = "~> 4.16"
}
}
        required_version = ">= 1.2.0"
}
  • Create a terraform file to download required providers on the system from a specific region.

  • Add the region where you want your instances to be.

COPY

COPY

provider "aws" {
region = "us-east-1"
}
  • Terraform will go to the region and download all the utilities required for aws connection to the terminal for infrastructure provisioning.


Thanks for reading my article. Have a nice day.

Comments

Popular posts from this blog

DevOps(Day-97): Meta-Arguments in Terraform

DevOps(Day-95): Auto Scaling with Terraform

DevOps (Day-1) Introduction