DEV Community

Cover image for AWS CLI Setup: IAM User Configuration & Command-Line Access
Adedamola Adedapo
Adedamola Adedapo

Posted on

AWS CLI Setup: IAM User Configuration & Command-Line Access

Assuming you've already navigated through the AWS Management Console and set up an IAM user using the AWS web console, as well as generated the essential access and secret keys for programmatic access, you're now ready to configure the AWS Command Line Interface (CLI) for seamless interaction with AWS services.

If you haven't completed these initial steps yet, don't worry! You can follow along with this hassle-free setup video here.

With your IAM user credentials in hand, let's proceed to install and configure the AWS CLI.

1. Installing the AWS CLI

To start, you'll need to install the AWS CLI client on your system. Refer to the detailed installation process outlined in the AWS official documentation here.

Once installed, you can verify that the CLI is accessible from your shell by using the following commands:

$ which aws
/usr/local/bin/aws 
$ aws --version
aws-cli/2.11.21 Python/3.11.3 Darwin/22.5.0 exe/x86_64 prompt/off
Enter fullscreen mode Exit fullscreen mode

2. Configuring the AWS CLI

Now that the AWS CLI is successfully installed, the next step is to configure it with your IAM user credentials. You can do this by running the aws configure command in your terminal and filling in the prompted fields with your access and secret keys.

$ aws configure
AWS Access Key ID [None]: <paste access key> -- generated in step 1 
AWS Secret Access Key [None]: <paste secret key> -- generated in step 1 
Default region name [None]:
Default output format [None]:
Enter fullscreen mode Exit fullscreen mode

Remember, you can always update these configuration values by rerunning the aws configure command.

3. Finding Your Default Region

To determine the appropriate value for the Default region name prompt, navigate to your AWS Management Console. Open the service you intend to access or make API calls to, and in the top-right corner of the screen, click on the second menu item to the left. Find the region that matches your desired location, such as eu-west-1 as in the image below.

AWS RDS screen showing the region where the service is sdeployed

Note that you cannot obtain your service region from the IAM service, as it is a global service.

Conclusion

With the AWS CLI now configured, you're all set to interact with AWS services seamlessly from your command line interface.

Top comments (0)