Install and Configure AWS CLI on your Local Machine

Install and Configure AWS CLI on your Local Machine

AWS Series (Part-2)

Introduction

AWS provides a set of open-source command-line tools called the AWS Command Line Interface (AWS CLI) that allow you to manage your AWS resources and engage with AWS services from a command-line interface. Many tasks, including configuring AWS S3 buckets, managing IAM users and roles, and creating and managing AWS EC2 instances, can be done with the help of the AWS CLI.

Why use AWS CLI?

  • You can communicate with many different AWS services, including EC2, S3, IAM, Lambda, RDS, and many more, using the AWS CLI.

  • Just like with the AWS Management Console, you can use commands to create, configure, and manage AWS resources and services.

  • The output formats supported by the AWS CLI are JSON, text, and table formats. The --output option allows you to specify the output format for each command.

  • Scripting and automation are popular uses for the AWS CLI, which lets you write and run scripts to programmatically manage AWS resources.

  • This is helpful for tasks like scheduling backups, automating deployments, and configuring infrastructure as code.

Installation

The AWS CLI can be installed on several operating systems, including Linux, macOS, and Windows. Depending on the type of your operating system, you can click here for a complete set of instructions on how to install the CLI on your local laptop.

Once the installation is complete, you can verify if the installation is successful using the "aws ls" command on your terminal, and if everything goes right, you should see something like this.

Configuration

Now that the installation is complete, you must configure the AWS CLI with your AWS credentials and settings before using it. For that, you must first create an access key and secret key from the AWS management console.

You can download the .csv file and store the credentials safely where no one else can access it.

Now, run "aws configure" on your terminal to configure the CLI, where you enter the default region, output format (such as JSON), secret access key, and AWS access key ID.

To test if the configuration is successful, create a bucket in S3 from the AWS console, and on the terminal see if you can list the bucket you just created using "aws s3 ls".

If the configuration is successful, you should see all the existing S3 buckets listed through your AWS CLI.

Conclusion

The AWS Command Line Interface (CLI) is flexible for managing AWS resources and is an essential tool for any developer or AWS administrator. It makes interacting with AWS services more efficient for users and is especially helpful for tasks involving automation and scripting.