Configure AWS CLI Profiles
To set up AWS CLI profiles, start by verifying the installation with aws --version
.
For IAM User credentials:
aws configure --profile <profile_name>
Enter your AWS Access Key ID, Secret Access Key, region, and output format when prompted.
For a more secure approach using AWS SSO:
aws configure sso --profile <sso_profile_name>
List configured profiles:
aws configure list-profiles
Switch between profiles using the --profile
option:
aws s3 ls --profile <profile_name>
To manually update config files, edit ~/.aws/config
and credentials
:
In credentials
:
[my_profile_name] aws_access_key_id=AKIA***EXAMPLE aws_secret_access_key=je7Mt***EXAMPLEKEY
In config
:
[profile my_profile_name] region=us-west-1 output=json
Set environment variables for convenience:
Unix-like systems:
export AWS_PROFILE=<profile_name>
Windows:
set AWS_PROFILE=profile_name
Switch AWS CLI Profiles
Use the --profile
flag to switch between profiles for specific commands:
aws s3 ls --profile user1
Set environment variables for a default profile in your terminal session:
- Unix-like systems:
export AWS_PROFILE=user2
- Windows Command Prompt:
set AWS_PROFILE=user2
- Windows PowerShell:
$env:AWS_PROFILE = 'user2'
For a permanent solution on Windows:
setx AWS_PROFILE=user2
Remember to reset the environment variable or restart your terminal when changing profiles.
Create Multiple AWS Profiles
Create profiles using the aws configure
command for IAM user credentials:
aws configure --profile <desired_profile_name>
For AWS SSO profiles:
aws configure sso --profile <sso_profile_name>
Alternatively, add profiles manually by editing configuration files in ~/.aws/
:
In credentials
:
[another_profile_name] aws_access_key_id=AKIAI9EXAMPLE aws_secret_access_key=joIPMj9EXAMPLEKEY
In config
:
[profile another_profile_name] region=us-east-2 output=table

Managing multiple AWS CLI profiles can streamline your workflow and maintain organized access across various accounts. Prioritize security as you work with these processes, ensuring safe credential management while improving productivity.
Writio: The ultimate AI content writer for websites and blogs. This article was written by Writio.
- AWS Command Line Interface Documentation. AWS Documentation.
- AWS CLI Configuration and Credential Files. AWS Documentation.
- Using AWS IAM Access Keys. AWS Documentation.