Set Up the AWS CLI and Configure Credentials
Install the AWS CLI, create an IAM access key, and configure a named profile so you can run AWS commands from your terminal.
beginner10 minmacos · windows · linuxUpdated August 2026
#aws#cli#iam
Requirements
- An AWS account
Choose your platform
0/3 steps · 0%
01
Install the AWS CLI
bash
$ brew install awscli02
Create an IAM access key
In the AWS Console, go to IAM → Users → your user → Security credentials → Create access key.
Warning
Never generate access keys for the root account. Create (or use) an IAM user with only the permissions you need.
03
Configure a named profile
bash
$ aws configure --profile {{PROFILE_NAME}}You'll be prompted for the access key ID, secret access key, default region, and output format.
bash
$ aws sts get-caller-identity --profile {{PROFILE_NAME}}Expected output
{
"UserId": "AIDAEXAMPLE",
"Account": "123456789012",
"Arn": "arn:aws:iam::123456789012:user/you"
}Success
That JSON confirms the CLI is authenticated as your IAM user.
Troubleshooting
The CLI isn't finding a profile to use — usually because `--profile` was left off, or `AWS_PROFILE` isn't set.
bash
$ export AWS_PROFILE={{PROFILE_NAME}}Add that line to your shell profile to avoid passing --profile on every command.