Comprehensive guides, command references, and best practices for the AWS command line interface.
Install AWS CLI on your operating system of choice
curl "https://awscli.amazonaws.com/AWSCLIV2-linux-x86_64.zip" -o "awscliv2.zip"
unzip awsawscliv2.zip
sudo ./aws/install
curl "https://awscli.amazonaws.com/AWSCLIV2-macos-x86_64.zip" -oawscliv2.zip
unzip awscliv2.zip
./aws/install
Set up credentials, regions, and default formats
aws configure
Enter AWS Access Key ID: [YOUR-AKID]
Enter aws Secret Access Key: [YOUR-SECRET]
Enter default region: us-east-1
Enter default output format: json
Store credentials in ~/.aws/credentials and configuration in ~/.aws/config.
Use aws configure list
to verify your settings.
aws configure --profile dev
aws configure set default.profile dev
Manage multiple environments with named profiles in ~/.aws/credentials.
Switch profiles using AWS CLI_PROFILE=dev aws s3 ls
Commonly used AWS CLI commands and their usage
aws ec2 describe-instances --query 'Reservations[*].Instances[*].{ID:InstanceId,Type:InstanceType}' --output table
Use JmesPath queries to extract specific fields from JSON outputs
aws s3 cp myfile.txt s3://my-bucket/docs/ --recursive
Recursive uploads to S3 with progress tracking
aws cloudfront create-invalidation --distribution-id DISTRIBUTION_ID --paths '/*'
Invalidate CloudFront cache to push new content
Common questions about AWS CLI usage
If not configured, the default output format is 'json'. You can change it with aws configure set default.output text
or specify on command line with --output
.
Supported formats: json
, text
, table
, yaml
.
AWS CLI works with all major AWS services
aws ec2, aws lambda, and other compute commands for instance and function management
View Compute Docs →The AWS CLI is completely free to use and integrates across all AWS services.