AWS CLI

Subscribe to my newsletter and never miss my upcoming articles

When it comes to handling AWS resources programmatically from a local machine or from pipeline the one that comes handy is CLI.

The Installing guide can be found below

We recommend using CLI v2 over v1 since you can get all the latest features

Installing guide for CLI v2 Click Here

Once the CLI is installed to check which version is installed

aws --version

How to get access keys?

Create your CLI Key by Navigating to IAM service -> UserName

image.png

Remember the generated access key can be viewed only once so store it in a secure location

Created credentials will look something like below. As shown you also download it as csv file

image.png

Configuring CLI

Next step is to configure our CLI credentials

aws configure

Use above command it will ask for below details

AWS Access Key ID : <<yourkeyid>>
AWS Secret Access Key : <<yourkey>>
Default region name : <<region name eg: us-east-1>>
Default output format : json

How to manage multiple account credentials?

There may be scenarios where you have multiple accounts and to store access keys and you can't configuring credentials each time on switching account. In that case, 'profiles' comes handy.

You can configure credentials assigning to a profile. <> can be any name to identify profile

aws configure --profile <<profilename>>

To access any one as default use

aws configure --profile default

In order to use credentials of that profile while accessing the cli commands add --profile along with the command

aws s3 ls --profile <<profilename>>

Hope you find this useful. Give a 👍 for more posts from us. We also run a youtube channel TechPechu in Tamil( Indian regional Language) do subscribe as a moral support! 😀

Happy Learning

No Comments Yet