AWS CLI Setup
Install and configure AWS CLI v2 on macOS, Linux, or Windows, then verify credentials and use profiles for multiple AWS accounts.
The AWS CLI is one of the most useful tools in a DevOps workflow because it turns console actions into repeatable commands. Once installed, you can query infrastructure, automate deployments, inspect logs, and test permissions from a terminal or CI pipeline. AWS CLI v2 is the current standard and works on macOS, Linux, and Windows.
Installation is platform-specific but conceptually simple: download the AWS-provided package, install it, and verify with aws --version. The next step is aws configure, which asks for an access key ID, secret access key, default Region, and output format. Those values are stored locally so later commands can authenticate without you retyping credentials each time.
| Setting | Purpose |
|---|---|
| Access key ID | Identifies the IAM credential |
| Secret access key | Proves you control that credential |
| Default Region | Sets the Region used when a command omits one |
| Output format | Chooses json, table, or text formatting |
Profiles make multi-account work safer. Instead of overwriting one set of credentials, create named profiles such as dev, staging, and prod. Then run commands with --profile prod when needed. This reduces mistakes and makes scripts more explicit about which account they target.
Two first commands are worth memorizing. aws sts get-caller-identity shows which identity the CLI is currently using. aws s3 ls is a quick sanity check that credentials and connectivity work. If either command fails, troubleshoot configuration before trying anything more complex.
Pair this lesson with AWS Account Setup so your CLI credentials come from a properly secured identity rather than the root user.
aws --version
aws configure
aws sts get-caller-identity
aws s3 ls
aws configure --profile prod
Operational note
Early AWS success usually comes from repeatable habits rather than memorizing every service. Use tags, consistent naming, and a short checklist for account setup, region awareness, and access patterns so new environments feel predictable instead of improvised. That discipline makes later automation, cost control, and incident response much easier. Shared standards like this make future environments easier to launch, review, and support.
CLI basics
What command is commonly used to set the default AWS Region and credentials locally?
Profile usage
Why are AWS CLI profiles useful?