AWS CLI Cheatsheet & Cloud Commands Cheat Sheet
Your cloud companion: AWS CLI cheatsheet and terminal cheat sheet. Explore S3 storage actions, EC2 status queries, security IAM setups, and serverless Lambda listings.
Interactive Skill Mastery
Mark commands as learned to build your customized reference tracker. Retained locally in this browser.
Configuration
When to Use
When managing, querying, or transferring cloud infrastructure files directly from local command shell profiles.
Common Mistakes
Hardcoding active Access Keys or Secret keys inside files (always use IAM service roles or credential profiles instead).
Shortcut / Pro-Tip
Set up named profiles with 'aws configure --profile <name>' to switch between development and production environments.Example
aws configureOutput Example
Cloud API resource transaction completed successfully. (Returns standardized JSON metadata details)When to Use
When managing, querying, or transferring cloud infrastructure files directly from local command shell profiles.
Common Mistakes
Hardcoding active Access Keys or Secret keys inside files (always use IAM service roles or credential profiles instead).
Shortcut / Pro-Tip
Set up named profiles with 'aws configure --profile <name>' to switch between development and production environments.Example
aws configure --profile <profile_name>Output Example
Cloud API resource transaction completed successfully. (Returns standardized JSON metadata details)When to Use
When managing, querying, or transferring cloud infrastructure files directly from local command shell profiles.
Common Mistakes
Hardcoding active Access Keys or Secret keys inside files (always use IAM service roles or credential profiles instead).
Shortcut / Pro-Tip
Set up named profiles with 'aws configure --profile <name>' to switch between development and production environments.Example
aws sts get-caller-identityOutput Example
Cloud API resource transaction completed successfully. (Returns standardized JSON metadata details)When to Use
When managing, querying, or transferring cloud infrastructure files directly from local command shell profiles.
Common Mistakes
Hardcoding active Access Keys or Secret keys inside files (always use IAM service roles or credential profiles instead).
Shortcut / Pro-Tip
Set up named profiles with 'aws configure --profile <name>' to switch between development and production environments.Example
aws sts assume-role --role-arn arn:aws:iam::123456789012:role/DeployRole --role-session-name AWSCLI-SessionOutput Example
Cloud API resource transaction completed successfully. (Returns standardized JSON metadata details)When to Use
When managing, querying, or transferring cloud infrastructure files directly from local command shell profiles.
Common Mistakes
Hardcoding active Access Keys or Secret keys inside files (always use IAM service roles or credential profiles instead).
Shortcut / Pro-Tip
Set up named profiles with 'aws configure --profile <name>' to switch between development and production environments.Example
aws cloudformation deploy --template-file template.yaml --stack-name production-stackOutput Example
Cloud API resource transaction completed successfully. (Returns standardized JSON metadata details)When to Use
When managing, querying, or transferring cloud infrastructure files directly from local command shell profiles.
Common Mistakes
Hardcoding active Access Keys or Secret keys inside files (always use IAM service roles or credential profiles instead).
Shortcut / Pro-Tip
Set up named profiles with 'aws configure --profile <name>' to switch between development and production environments.Example
aws ssm get-parameter --name "/prod/db/pass" --with-decryptionOutput Example
Cloud API resource transaction completed successfully. (Returns standardized JSON metadata details)S3 Storage
When to Use
When managing, querying, or transferring cloud infrastructure files directly from local command shell profiles.
Common Mistakes
Hardcoding active Access Keys or Secret keys inside files (always use IAM service roles or credential profiles instead).
Shortcut / Pro-Tip
Set up named profiles with 'aws configure --profile <name>' to switch between development and production environments.Example
aws s3 lsOutput Example
Cloud API resource transaction completed successfully. (Returns standardized JSON metadata details)When to Use
When managing, querying, or transferring cloud infrastructure files directly from local command shell profiles.
Common Mistakes
Hardcoding active Access Keys or Secret keys inside files (always use IAM service roles or credential profiles instead).
Shortcut / Pro-Tip
Set up named profiles with 'aws configure --profile <name>' to switch between development and production environments.Example
aws s3 mb s3://<bucket-name>Output Example
Cloud API resource transaction completed successfully. (Returns standardized JSON metadata details)When to Use
When managing, querying, or transferring cloud infrastructure files directly from local command shell profiles.
Common Mistakes
Hardcoding active Access Keys or Secret keys inside files (always use IAM service roles or credential profiles instead).
Shortcut / Pro-Tip
Set up named profiles with 'aws configure --profile <name>' to switch between development and production environments.Example
aws s3 cp <local_file> s3://<bucket>/<path>Output Example
Cloud API resource transaction completed successfully. (Returns standardized JSON metadata details)When to Use
When managing, querying, or transferring cloud infrastructure files directly from local command shell profiles.
Common Mistakes
Hardcoding active Access Keys or Secret keys inside files (always use IAM service roles or credential profiles instead).
Shortcut / Pro-Tip
Set up named profiles with 'aws configure --profile <name>' to switch between development and production environments.Example
aws s3 sync <local_folder> s3://<bucket>/Output Example
Cloud API resource transaction completed successfully. (Returns standardized JSON metadata details)When to Use
When managing, querying, or transferring cloud infrastructure files directly from local command shell profiles.
Common Mistakes
Hardcoding active Access Keys or Secret keys inside files (always use IAM service roles or credential profiles instead).
Shortcut / Pro-Tip
Set up named profiles with 'aws configure --profile <name>' to switch between development and production environments.Example
aws s3 sync s3://<bucket-src> s3://<bucket-dest>Output Example
Cloud API resource transaction completed successfully. (Returns standardized JSON metadata details)EC2 Instances
When to Use
When managing, querying, or transferring cloud infrastructure files directly from local command shell profiles.
Common Mistakes
Hardcoding active Access Keys or Secret keys inside files (always use IAM service roles or credential profiles instead).
Shortcut / Pro-Tip
Set up named profiles with 'aws configure --profile <name>' to switch between development and production environments.Example
aws ec2 describe-instances --filters "Name=instance-state-name,Values=running"Output Example
Cloud API resource transaction completed successfully. (Returns standardized JSON metadata details)When to Use
When managing, querying, or transferring cloud infrastructure files directly from local command shell profiles.
Common Mistakes
Hardcoding active Access Keys or Secret keys inside files (always use IAM service roles or credential profiles instead).
Shortcut / Pro-Tip
Set up named profiles with 'aws configure --profile <name>' to switch between development and production environments.Example
aws ec2 start-instances --instance-ids <id>Output Example
Cloud API resource transaction completed successfully. (Returns standardized JSON metadata details)When to Use
When managing, querying, or transferring cloud infrastructure files directly from local command shell profiles.
Common Mistakes
Hardcoding active Access Keys or Secret keys inside files (always use IAM service roles or credential profiles instead).
Shortcut / Pro-Tip
Set up named profiles with 'aws configure --profile <name>' to switch between development and production environments.Example
aws ec2 terminate-instances --instance-ids <id>Output Example
Cloud API resource transaction completed successfully. (Returns standardized JSON metadata details)IAM Security
When to Use
When managing, querying, or transferring cloud infrastructure files directly from local command shell profiles.
Common Mistakes
Hardcoding active Access Keys or Secret keys inside files (always use IAM service roles or credential profiles instead).
Shortcut / Pro-Tip
Set up named profiles with 'aws configure --profile <name>' to switch between development and production environments.Example
aws iam list-usersOutput Example
Cloud API resource transaction completed successfully. (Returns standardized JSON metadata details)When to Use
When managing, querying, or transferring cloud infrastructure files directly from local command shell profiles.
Common Mistakes
Hardcoding active Access Keys or Secret keys inside files (always use IAM service roles or credential profiles instead).
Shortcut / Pro-Tip
Set up named profiles with 'aws configure --profile <name>' to switch between development and production environments.Example
aws kms encrypt --key-id 1234abcd-12ab-34cd-56ef-1234567890ab --plaintext fileb://data.txt --output textOutput Example
Cloud API resource transaction completed successfully. (Returns standardized JSON metadata details)Lambda & Services
When to Use
When managing, querying, or transferring cloud infrastructure files directly from local command shell profiles.
Common Mistakes
Hardcoding active Access Keys or Secret keys inside files (always use IAM service roles or credential profiles instead).
Shortcut / Pro-Tip
Set up named profiles with 'aws configure --profile <name>' to switch between development and production environments.Example
aws lambda list-functions --max-items 10Output Example
Cloud API resource transaction completed successfully. (Returns standardized JSON metadata details)When to Use
When managing, querying, or transferring cloud infrastructure files directly from local command shell profiles.
Common Mistakes
Hardcoding active Access Keys or Secret keys inside files (always use IAM service roles or credential profiles instead).
Shortcut / Pro-Tip
Set up named profiles with 'aws configure --profile <name>' to switch between development and production environments.Example
aws dynamodb scan --table-name <table_name>Output Example
Cloud API resource transaction completed successfully. (Returns standardized JSON metadata details)When to Use
When managing, querying, or transferring cloud infrastructure files directly from local command shell profiles.
Common Mistakes
Hardcoding active Access Keys or Secret keys inside files (always use IAM service roles or credential profiles instead).
Shortcut / Pro-Tip
Set up named profiles with 'aws configure --profile <name>' to switch between development and production environments.Example
aws lambda update-function-code --function-name <name> --zip-file fileb://file.zipOutput Example
Cloud API resource transaction completed successfully. (Returns standardized JSON metadata details)When to Use
When managing, querying, or transferring cloud infrastructure files directly from local command shell profiles.
Common Mistakes
Hardcoding active Access Keys or Secret keys inside files (always use IAM service roles or credential profiles instead).
Shortcut / Pro-Tip
Set up named profiles with 'aws configure --profile <name>' to switch between development and production environments.Example
aws logs tail /aws/lambda/my-function --follow --format shortOutput Example
Cloud API resource transaction completed successfully. (Returns standardized JSON metadata details)AWS CLI Best Practices
1Adopt Named Profiles Exclusively
Isolate client projects and access credentials using named workspace profiles (aws configure --profile label).
2Secure Root Access Keys Rigorously
Never generate root user API access keys. Provision least-privileged IAM developer user accounts and assume custom roles instead.
3Configure Safe S3 Transfers
Enable encryption and versioning on target buckets before transferring files using 'aws s3 cp' or sync.
4Format Terminal Outputs cleanly
Request structured, filterable terminal responses by appending --output json or --output table to commands.
5Optimize large queries with jq
Combine AWS CLI filtering queries with command line utilities like jq to parse nested arrays and objects quickly.
Common AWS CLI Errors & Solutions
SignatureDoesNotMatch: Access Key invalid
Double-check your credentials inside ~/.aws/credentials. Regenerate keys or configure profiles again with correct inputs.
AccessDenied: User not authorized to perform
Your IAM user account lacks permissions for that cloud command. Add the missing policy permission to the user role in the IAM console.
ExpiredToken: Request has expired
Your temporary session token (often from AWS SSO or STS) has expired. Re-authenticate using: aws sso login or aws sts.
BucketName already exists globally
S3 bucket folders share a universal global namespace. Choose a completely unique, randomized name string for your bucket.
Region parameter missing or invalid
Set the default location parameter in your active profile, or append '--region us-east-1' directly to the active terminal execution.
Common AWS CLI Interview Questions
Q1What is the AWS CLI and what is its primary use case?
The AWS Command Line Interface (CLI) is a unified tool to manage your AWS cloud services from terminal scripts. It allows developers to automate deployments, script object uploads to S3, manage EC2, and configure IAM.
Q2How do you specify distinct user accounts or credentials in the AWS CLI?
By configuring named profiles with 'aws configure --profile <name>'. You can then execute commands for a specific user profile by appending the '--profile' flag to any command.
Q3What is the difference between 'aws s3 cp' and 'aws s3 sync'?
aws s3 cp copies specific individual files or objects between local paths and S3. aws s3 sync recursively compares and synchronizes whole directories, only copying modified or new files to save bandwidth.
Q4How do you filter outputs in AWS CLI without downloading massive JSON payloads?
By utilizing the built-in '--query' parameter, which executes client-side JMESPath queries (e.g. --query 'Reservations[*].Instances[*].InstanceId') to return only specific attributes.
Q5What files store credentials locally and where are they located?
AWS CLI stores configuration parameters and credentials in a hidden directory at the user root (~/.aws/). Key configurations are saved in 'config', and sensitive secret keys are stored in 'credentials'.
Related Resources
REST API Tester
Test API routes and endpoints directly in your browser with full request controls.
JSON Formatter & Validator
Beautify, validate, and minify JSON structures instantly.
Best Free Online Developer Tools
An expert review of must-have online utilities for developers.
Git Cheatsheet
Essential command reference for local and remote version control repositories.
Generated from LearnHubly Developer Cheatsheets
Access interactive sandbox tests, tools, and developer code bases at https://www.learnhubly.com