The AWS Command Line Interface version 2 is Amazon's official command-line tool for managing AWS services from a terminal. Installing it achieves a single, scriptable way to create resources, move files, and check configuration without clicking through the web console. The short version: download the official v2 installer for your operating system, run it, open a new terminal, run aws configure, paste an access key and secret, choose a default region and output format, then test with a harmless command like aws s3 ls. Everything below fills in the details, including the permissions you need and the errors you are most likely to hit.

What You'll Need

  • An AWS account with permission to create or use IAM credentials. If you manage a shared account, ask whoever owns it rather than creating keys on your own.
  • An access key ID and secret access key for an IAM user or role, created in the IAM console. New AWS accounts may need an administrator to enable key creation for that user.
  • Administrator rights on your computer, because the installer writes to system locations.
  • A terminal: Terminal on macOS and Linux, or PowerShell and Command Prompt on Windows.
  • The default region code for your resources, for example us-east-1 or eu-west-1. The console's region selector shows the code.
  • Commonly, the AWS CLI uses Python libraries bundled inside the installer, so you do not need a separate Python install for v2. The older v1 was pip-based and that difference matters during upgrades.

Step-by-Step

  1. Confirm whether v1 is already installed. Run aws --version. Output that starts with aws-cli/2. means v2 is present and you can skip to configuration. Output starting with aws-cli/1. means you have the legacy version. On macOS and Linux, remove it first with pip uninstall awscli or the package manager that installed it; on Windows, use the v1 uninstaller in Apps & features. Mixing both on one PATH causes confusing behaviour, so uninstall before installing v2.
  2. Download the installer from Amazon's official page. Go to the AWS CLI download page at aws.amazon.com/cli and choose the v2 installer for your platform. Use only this page; avoid third-party mirrors and package repositories that may ship an old or altered build. Labels on vendor pages change occasionally, so pick the entry that explicitly says version 2.
  3. Install it. On Windows, run the .msi and accept the defaults; the installer adds the aws command to the system PATH. On macOS, the installer package handles this for you. On Linux, unpack the zip and run the bundled ./aws/install script, which places files under /usr/local/aws-cli and links the binary into /usr/local/bin. If you cannot write there, use ./aws/install -i ~/aws-cli -b ~/bin and make sure ~/bin is on your PATH.
  4. Open a fresh terminal window. The PATH change from the installer only applies to new sessions. Run aws --version again and confirm it reports aws-cli/2.
  5. Create credentials in the IAM console. Sign in, open IAM, select your user, and use the security credentials area to create an access key. Choose the use case that matches command-line access. Copy the secret immediately, because it is shown once and cannot be retrieved later. Grant only the permissions you need; a user with AmazonS3ReadOnlyAccess is a better fit for listing buckets than a full administrator.
  6. Run the configuration wizard. Type aws configure. It asks four questions in order: access key ID, secret access key, default region name, and default output format. Region accepts a code such as us-west-2; output accepts json, yaml, table or text. Press Enter to accept the default json. The wizard writes two files: ~/.aws/credentials for keys and ~/.aws/config for region and output. On Windows these live under %USERPROFILE%\.aws.
  7. Test with a read-only command. Run aws s3 ls. An empty result means the call succeeded and the account has no buckets in that region. A list of buckets means everything is wired up. If you lack S3 permissions, try aws sts get-caller-identity, which returns your account and user ARN and needs no special permissions.
  8. Optionally set up named profiles. For more than one account, run aws configure --profile work and repeat the wizard. Then add --profile work to commands, or set AWS_PROFILE=work in your environment. Check which profile is active with aws configure list.
  9. Verify shell completion, if you want it. The v2 installers include a completions helper. On bash or zsh, follow the completion instructions printed by aws --help or found in the official user guide. Completion is optional and never required for commands to work.

Common Mistakes

Leaving v1 installed. Both versions expose an aws binary, and the one earlier in the PATH wins. Symptom: the version check keeps reporting 1.x after you installed v2. Fix by uninstalling v1 and opening a new shell.

Pasting the secret key with hidden whitespace. A trailing space or a newline copied from a password manager becomes part of the key, and every request fails with a signature error. Re-run aws configure and type the value cleanly, or edit the credentials file and check for stray characters.

Wrong region. Commands silently target the configured default. An S3 listing that is empty or a resource that "does not exist" often simply lives elsewhere. Pass --region to test, then correct the default in aws configure.

Using root account keys. Root access keys grant full control over billing and account settings. Use an IAM user or, better on servers, an IAM role attached to the instance or container.

Committing credentials to Git. Keys pasted into scripts or notebooks end up in repositories. Keep them in the AWS files, environment variables, or a secrets manager, and rotate any key that has been exposed.

Tips

Use aws <service> help and aws <service> <operation> help rather than guessing syntax; the built-in help is versioned with the tool. Add --dry-run where a service supports it to check permissions without making changes. Set --output table for human reading and --output json with --query for scripting, for example --query "Buckets[].Name". Put --no-cli-pager in scripts so output is not held in a pager. Keep the CLI updated, since new services and parameters only appear in newer builds, and watch for deprecation notices in release notes.

Troubleshooting

"aws: command not found". The binary is not on the PATH. Close and reopen the terminal, check the install location, and on Linux confirm the install directory is in $PATH.

"Unable to locate credentials". No profile was configured, or the active profile name does not match. Run aws configure list to see what is loaded, and check that the credentials file exists and is readable.

"InvalidClientTokenId" or "SignatureDoesNotMatch". The key is wrong, truncated, deactivated, or belongs to a different account. Create a new key in IAM, reconfigure, and delete the old one.

"AccessDenied". Credentials are valid but the policy does not allow the action. The error usually names the missing action; ask the account owner to add it to the user's policy.

SSL or proxy errors in a corporate network. The network may intercept traffic. Point the CLI at your organisation's certificate bundle through the ca_bundle setting in the config file, and configure proxy variables as your IT team directs.

Clock skew errors. Request signing depends on accurate time. Sync your system clock and retry.

If none of that helps, run the failing command with --debug to see the request and response, and compare against the official user guide for your version.

Frequently Asked Questions

Do I need Python installed for AWS CLI v2?

No. The v2 installers bundle their own runtime. A separate Python install is only relevant if you are removing an old pip-based v1.

Can I use the CLI without access keys?

Yes, on AWS compute. An IAM role attached to an EC2 instance, container task, or similar environment supplies temporary credentials automatically, and no keys are stored on disk.

Where are my credentials stored?

In ~/.aws/credentials on macOS and Linux, and %USERPROFILE%\.aws\credentials on Windows, unless you use environment variables or roles. The file is plain text, so protect its permissions.

How do I switch between multiple accounts?

Create a named profile per account with aws configure --profile name, then pass --profile name on commands or set the AWS_PROFILE environment variable.

How do I update the CLI?

Download and run the current v2 installer for your platform again; it replaces the existing installation and keeps your configuration files untouched.

Why does a command return nothing at all?

An empty result usually means success with no matching resources in the selected region. Confirm the region with aws configure list before assuming something is broken.