Friday, May 8, 2020

Install aws and Terraform and configration on CentOS 7


aws configure
Prerequisites:
You must ensure that you have at least Python 2 version 2.6.5+ or Python 3 version 3.3+ installed.

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip

Once the package in unzipped, you can run the installation:

sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws

Using the -b option allows all users to use the AWS CLI from any directory, meaning you will not need to specify the install directory in the user’s $PATH variable

The default output format specifies how the results are formatted. Values that can be used here include:

    json
    text
    table

$ aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-west-2
Default output format [None]: json

Multipal user
[default]
aws_access_key_id = AKIA5XDQIIYS6
aws_secret_access_key = eOHLpqPt0DQy5pIquRYyFq2+lk6VBNdoGC2f
[mukesh]
aws_access_key_id = AKIA5XDQIIYSZHQPZ
aws_secret_access_key = +x3yuhaARhYeSrgIkYtWwOtE862LfDBhozCv





How to Install Terraform on CentOS 7

To install Terraform on CentOS, start by updating the repository lists:

sudo yum update

You’ll need wget and unzip – if you don’t have them, install them by entering:

sudo yum install wget unzip

Download Terraform from the developer’s website:

sudo wget https://releases.hashicorp.com/terraform/0.12.2/terraform_0.12.2_linux_amd64.zip

Extract the downloaded file:

sudo unzip ./terraform_0.12.2_linux_amd64.zip -d /usr/local/bin

The output confirms that the files are now located in the /usr/local/bin directory.

output showing /usr/local/bin directory

Lastly, verify that Terraform accepts commands:

terraform –v

The system should display Terraform v.0.12.2.

Terraform version v.0.12.2. installed screen


Basic Terraform Usage Tutorial

Terraform is a tool used to manage datacenter infrastructure. That typically means providing access to cloud services like Azure, Amazon Web Services, and so forth. This tutorial will use AWS as an example.
Create a Directory and Configuration File

Enter the following:

mkdir sample

cd sample

Terraform uses a .tf configuration file. Create and edit one by entering:

sudo nano test.tf

Enter the following:

provider "aws" {
  region     = "us-west-2"
  access_key = "access_key"
  secret_key = "secret_key"
}

Replace access_key and secret_key with your own AWS keys.
How to Initialize Terraform

To initialize Terraform, enter the following:

terraform init

No comments:

Post a Comment