← Back to tools

AWS CLI

Official command-line interface for Amazon Web Services

Cloud & Services linuxmacoswindows Python Apache-2.0

Description

The AWS CLI is the unified tool to manage AWS services from the terminal. It provides direct access to the full breadth of AWS APIs, enabling scripting, automation, and infrastructure management across EC2, S3, Lambda, IAM, and hundreds of other services.

Install

homebrewbrew install awscli
pippip install awscli

AI Summary

Official AWS CLI. Manage every AWS service from the terminal — EC2 instances, S3 buckets, Lambda functions, IAM roles, and hundreds more. The backbone of AWS automation and scripting.

Capabilities

  • + Manage EC2 instances, VPCs, security groups, and networking
  • + Upload, download, and sync files with S3
  • + Deploy and invoke Lambda functions
  • + Manage IAM users, roles, and policies
  • + Query and filter output with built-in --query (JMESPath)
  • + Configure multiple named profiles for different accounts
  • + Generate pre-signed URLs for S3 objects

Use When

  • Managing any AWS resource from the terminal or scripts
  • Automating AWS infrastructure provisioning and deployment
  • Transferring files to and from S3
  • Scripting CI/CD pipelines that interact with AWS
  • Querying AWS resource state for monitoring or debugging

Avoid When

  • x Managing non-AWS cloud resources (use gcloud, az, doctl instead)
  • x Need declarative infrastructure-as-code (use Terraform or CloudFormation)
  • x Simple static site hosting without other AWS needs (use Vercel or Netlify)

Usage Patterns

List running EC2 instances

aws ec2 describe-instances --query 'Reservations[].Instances[?State.Name==`running`].[InstanceId,InstanceType,PublicIpAddress]' --output table

Queries all running instances and displays ID, type, and IP in a table

Upload a file to S3

aws s3 cp ./build s3://my-bucket/deploy/ --recursive

Recursively copies a local build directory to an S3 bucket prefix

Invoke a Lambda function

aws lambda invoke --function-name my-func --payload '{"key":"value"}' response.json

Invokes a Lambda function with a JSON payload and saves the response

Assume a role for cross-account access

aws sts assume-role --role-arn arn:aws:iam::123456789012:role/MyRole --role-session-name session1

Gets temporary credentials for a cross-account IAM role

Input / Output

stdin: JSON payloads for some commands (e.g., --cli-input-json)
stdout: JSON, text, table, or YAML formatted AWS API responses
Exit codes:
0 Success
1 Error (client or server side)
2 Command not found or usage error
130 SIGINT (Ctrl-C)

Typical Pipelines

aws ec2 describe-instances | jq '.Reservations[].Instances[] | {id: .InstanceId, state: .State.Name}'
aws s3 ls s3://my-bucket/ --recursive | awk '{print $4}' | fzf | xargs -I{} aws s3 cp s3://my-bucket/{} .
aws logs filter-log-events --log-group-name /app/prod --start-time $(date -d '1 hour ago' +%s000) | jq -r '.events[].message'

Related Tools

View AGENTS.md for AWS CLI