AWS, Cloud Computing

3 Mins Read

The Power of AWS CLI Profiles and Profile Selector Script

Voiced by Amazon Polly


The AWS CLI profile is a crucial component for AWS users, allowing them to manage multiple AWS accounts and access resources seamlessly. AWS Command Line Interface (CLI) profile essentially encapsulates authentication credentials and configuration settings, streamlining the interaction with different AWS environments. With the ability to define named profiles, users can effortlessly switch between accounts, regions, and even access keys, enhancing flexibility and security in their command-line interactions.


Welcome to the realm of AWS Command Line Interface (CLI) profiles, a pivotal element in the toolkit of AWS enthusiasts and cloud professionals.

As cloud environments grow in complexity and diversity, managing multiple AWS accounts and navigating configurations becomes necessary. The AWS CLI profile emerges as the guiding force, offering users a streamlined approach to wielding command-line power across different AWS settings.

In this blog, we embark on a journey to unravel the significance of AWS CLI profiles, exploring their role in simplifying authentication configuration and empowering users to navigate the AWS landscape with finesse. Whether you’re a seasoned cloud engineer or just stepping into the world of AWS, understanding and harnessing the capabilities of AWS CLI profiles is a key step in optimizing your command-line experience. Let’s dive in!

Pioneers in Cloud Consulting & Migration Services

  • Reduced infrastructural costs
  • Accelerated application deployment
Get Started

AWS CLI Profiles

In AWS CLI, profiles are named configurations that streamline the management of multiple AWS settings. They include access keys, regions, and output preferences, enabling users to switch between AWS accounts and regions effortlessly. Profiles are a key feature for efficiently handling authentication and customizing configurations, enhancing flexibility and security in AWS CLI operations.

Steps to Set up the AWS CLI Profiles

  1. Open your terminal or command prompt.
  2. Run the following command, replacing <profile-name> with the desired name for your AWS CLI profile:

3. You will be prompted to enter the AWS Access Key ID, Secret Access Key, default region, and output format. Provide the necessary information when prompted.

4. After entering the required information, the AWS CLI will create a profile with the specified name in your AWS configuration file (~/.aws/config on Linux or macOS or %UserProfile%\.aws\config on Windows).

Listing all the AWS CLI Profiles

To list all the AWS CLI profiles, run the command “aws configure list-profiles”

Using AWS CLI Profiles

You can use the AWS CLI profiles with all the aws commands using the flag “—profile”. For example: “aws s3 ls –profile <profile-name>”

You can also export the environment variable “AWS_PROFILE” with the profile name, and the aws cli would pick that profile for subsequent aws cli calls.

For more information on using AWS CLI profiles, please refer this link.

The Challenge

While working on a client project with multiple AWS accounts, I set up multiple AWS CLI profiles for each. But switching between them was a very tedious task. Whenever I opened a new command prompt, I had to manually export the “AWS_PROFILE” variable with the appropriate profile value. Also, when I wanted to switch accounts, I had to export the “AWS_PROFILE” variable again. Doing this multiple times a day was quite frustrating. Then, I took the matter into my own hands and wrote a bash script to tackle this challenge.

The Script

How to execute it?

Copy the script from above, make a file in “/usr/local/bin/” with the “acps” (short form of AWS CLI profile selector), and paste the contents in the file. Then make it an executable using “chmod +x <filename>” and you are ready. Run “. acps” from the command prompt, and the script will execute.

Note: You need the “.” in front of the command to export the variable.



In conclusion, the custom Bash script introduced in this blog revolutionizes AWS CLI profile management. As Cloud Engineers, optimizing workflows is key, and this script provides an efficient solution. Seamlessly integrating profile selection into the command prompt enhances productivity and simplifies the AWS CLI experience, making it an invaluable tool for cloud professionals.

Drop a query if you have any questions regarding AWS CLI and we will get back to you quickly.

Making IT Networks Enterprise-ready – Cloud Management Services

  • Accelerated cloud migration
  • End-to-end view of the cloud environment
Get Started

About CloudThat

CloudThat is a leading provider of Cloud Training and Consulting services with a global presence in India, the USA, Asia, Europe, and Africa. Specializing in AWS, Microsoft Azure, GCP, VMware, Databricks, and more, the company serves mid-market and enterprise clients, offering comprehensive expertise in Cloud Migration, Data Platforms, DevOps, IoT, AI/ML, and more.

CloudThat is recognized as a top-tier partner with AWS and Microsoft, including the prestigious ‘Think Big’ partner award from AWS and the Microsoft Superstars FY 2023 award in Asia & India. Having trained 650k+ professionals in 500+ cloud certifications and completed 300+ consulting projects globally, CloudThat is an official AWS Advanced Consulting Partner, AWS Training Partner, AWS Migration Partner, AWS Data and Analytics Partner, AWS DevOps Competency Partner, Amazon QuickSight Service Delivery Partner, Amazon EKS Service Delivery Partner, Microsoft Gold Partner, AWS Microsoft Workload Partners, Amazon EC2 Service Delivery Partner, and many more.

To get started, go through our Consultancy page and Managed Services PackageCloudThat’s offerings.


1. How do I create a new AWS CLI profile?

ANS: – You can create a new AWS CLI profile using the aws configure –profile command, followed by the desired profile name. This will prompt you to enter the required configuration details for the new profile.

2. How can I list all existing AWS CLI profiles on my system?

ANS: – You can use the command aws configure list-profiles to list all AWS CLI profiles.

3. Is it possible to update the configuration of an existing AWS CLI profile?

ANS: – Yes, you can update the configuration of an existing AWS CLI profile by using the aws configure –profile <profile-name> command. It will prompt you to modify the existing configuration.

WRITTEN BY Avinash Kumar

Avinash Kumar is a Senior Research Associate at CloudThat, specializing in Cloud Engineering, NodeJS development, and Google Cloud Platform. With his skills, he creates innovative solutions that meet the complex needs of today's digital landscape. He's dedicated to staying at the forefront of emerging cloud technologies.



    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!