DEV Community

Mahinsha Nazeer
Mahinsha Nazeer

Posted on • Originally published at Medium on

Configuring AWS CLI for Terraform / Script Automation

First, we need to create an AWS account:

Sign up for your AWS account to get 100$ credits. Then create a new user in AWS, for that go to IAM:

Go to IAM > Users > Add Users.

  • Enter a Username (I am using my username as ‘admin’)
  • Select the Access Type :
  • Programmatic Access : For API/CLI/SDK access. (here I am giving administrator access)
  • Now click on ‘create user’


figure 1

Once the user is created, click on the username and create an access key, that can be configured on Terraform or AWS CLI.


figure 2

Once you click on the access key, there will 3 steps;

Step 1: Choose ‘Command line interface’


figure 3

Step 2: Give a description tag.

Step 3: Retrieve keys.

You can download the credentials as a csv file or you can keep it in a seperate file.

Now we can proceed with configuring AWS CLI in the base machine, so here I am using my personal laptop as my base machine and it is running on arch-linux.

To install AWS CLI you can run the following command in any linux machine:

 curl “https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o “awscli-bundle.zip”

unzip awscli-bundle.zip

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

 If it the above commands are not working , you can refer the following URL:  

 [h](https://docs.aws.amazon.com/cli/v1/userguide/install-linux.html)ttps://docs.aws.amazon.com/cli/v1/userguide/install-linux.html

![](https://cdn-images-1.medium.com/max/1024/1*tgVnqA6O0yKs3wioRNZzTw.png)

If you are using arch-Linux and facing any error with installation, you can install aws-cli from the arch repository itself:  

 One the installation is completed, run the following command to configure aws-cli in your machine.  

 1. aws configure.  

 It will ask for a few details, and provide the details. If you don’t know the details refer to AWS documentation for the recommended one.

![](https://cdn-images-1.medium.com/max/1008/1*KqGXC7gefWnTYpXhTZB-gg.png)

Once configured, simply type ‘aws cli’ to see whether the configuration is working fine or not.
Enter fullscreen mode Exit fullscreen mode

Top comments (0)