Skip to content

NKCODE TECH GEEK ZONE

  • RSS - Posts
Menu
  • Home
  • Cloud
    • Azure
    • Alibaba
    • AWS
  • Hardware
  • Linux
  • Network
  • Security
  • Windows Client / Servers
    • SQL
    • Windows Client OS
      • Windows 10
    • Windows Servers
      • Windows 2008R2
      • Windows Server 2012R2
      • Windows Server 2016
      • Windows Server 2019
  • VMWARE
  • Free Tools
  • About Me
    • Disclaimer
Menu

๐Ÿ› ๏ธ AWS CLI Made Simple: A Handy Guide for Engineers

Posted on February 12, 2025

Whether you’re managing cloud infrastructure, deploying applications, or automating tasks, the AWS Command Line Interface (CLI) is an essential tool in every engineerโ€™s toolkit. This cheat sheet provides a concise yet powerful collection of commonly used AWS CLI commands across core services โ€” perfect for quick reference and daily operations.

๐Ÿ“ฆ Getting Started

Before using the CLI, install and configure:

# Install AWS CLI v2 (Linux/macOS)
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip && sudo ./aws/install

# Configure CLI
aws configure

You’ll be prompted to enter:

  • Access Key ID

  • Secret Access Key

  • Default Region (e.g., us-east-1)

  • Default Output Format (json, table, or text)

๐Ÿ” Identity & Access Management (IAM)

 

# List users
aws iam list-users

# Create a new user
aws iam create-user --user-name <username>

# Attach policy to a user
aws iam attach-user-policy \
  --user-name <username> \
  --policy-arn arn:aws:iam::aws:policy/AmazonS3FullAccess

๐Ÿ—‚๏ธ S3 (Simple Storage Service)

# List buckets
aws s3 ls

# Create a bucket
aws s3 mb s3://my-bucket-name

# Upload file
aws s3 cp myfile.txt s3://my-bucket-name/

# Download file
aws s3 cp s3://my-bucket-name/myfile.txt .

# Sync local dir to S3
aws s3 sync ./mydir s3://my-bucket-name/

# Delete file
aws s3 rm s3://my-bucket-name/myfile.txt

โ˜๏ธ EC2 (Elastic Compute Cloud)

# List EC2 instances
aws ec2 describe-instances

# Launch EC2 instance
aws ec2 run-instances \
  --image-id ami-0abcdef1234567890 \
  --count 1 \
  --instance-type t2.micro \
  --key-name my-key-pair \
  --security-groups my-security-group

# Stop instance
aws ec2 stop-instances --instance-ids i-0123456789abcdef0

# Start instance
aws ec2 start-instances --instance-ids i-0123456789abcdef0

# Terminate instance
aws ec2 terminate-instances --instance-ids i-0123456789abcdef0

๐Ÿ“Š CloudWatch

# List metrics
aws cloudwatch list-metrics

# Get metric data
aws cloudwatch get-metric-data \
  --metric-data-queries file://queries.json \
  --start-time 2025-07-10T00:00:00Z \
  --end-time 2025-07-11T00:00:00Z

๐Ÿ—๏ธ CloudFormation

# Deploy a stack
aws cloudformation deploy \
  --template-file template.yaml \
  --stack-name my-stack \
  --capabilities CAPABILITY_NAMED_IAM

# Delete a stack
aws cloudformation delete-stack --stack-name my-stack

๐Ÿณ ECS (Elastic Container Service)

# List clusters
aws ecs list-clusters

# List services in a cluster
aws ecs list-services --cluster my-cluster

# Describe a service
aws ecs describe-services \
  --cluster my-cluster \
  --services my-service

# Update a service (force new deployment)
aws ecs update-service \
  --cluster my-cluster \
  --service my-service \
  --force-new-deployment

๐Ÿ›ก๏ธ Security Groups & Networking

# List security groups
aws ec2 describe-security-groups

# Authorize ingress rule
aws ec2 authorize-security-group-ingress \
  --group-id sg-12345678 \
  --protocol tcp \
  --port 22 \
  --cidr 0.0.0.0/0

๐Ÿ” Secrets Manager

# List secrets
aws secretsmanager list-secrets

# Get secret value
aws secretsmanager get-secret-value \
  --secret-id my-secret

๐Ÿ“œ Useful Flags & Tips

  • --region <region> โ€” override default region

  • --profile <profile> โ€” use a specific profile

  • --query โ€” filter results using JMESPath

  • --output table โ€” human-readable format

Example:

aws ec2 describe-instances --query "Reservations[*].Instances[*].InstanceId" --output text

๐Ÿ“š Resources

  • AWS CLI Official Docs

  • AWS CLI GitHub

โœ… Conclusion

The AWS CLI is a powerful tool that can dramatically speed up your workflow and enable automation. Keep this cheat sheet handy for quick access to the most commonly used commands โ€” and don’t be afraid to explore further with the aws help command.

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to share on Telegram (Opens in new window) Telegram
  • Click to share on WhatsApp (Opens in new window) WhatsApp
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to email a link to a friend (Opens in new window) Email

Like this:

Like Loading...

Related

Welcome to Teck Geek Zone

Alibaba & Azure Cloud with a free trial worth $200-1200 USD Click below Cloud Providers

  • Securing Your Cloud Environment with Alibaba Cloud Firewall
  • ๐Ÿšข Sailing into the Data Age: How Cloud and IoT are Revolutionizing the Marine Industry
  • What is Azure Grafana? A Comprehensive Guide to Monitoring and Visualization
  • ๐Ÿ” How to Enable Virtualization-Based Security (VBS) for Windows Workloads in VMware Cloud Foundation and vSphere
  • Microsoftโ€™s Azure SRE Agent: AI-Powered Reliability Engineering

Categories

  • Cloud (186)
    • Alibaba (39)
    • AWS (39)
    • Azure (114)
  • Free Tools (5)
  • Hardware (17)
  • Linux (13)
  • Network (28)
  • Security (21)
  • VMWARE (54)
  • Windows OS (44)
    • Windows 10 (7)
  • Windows Servers (69)
    • SQL (3)
    • Windows 2008R2 (7)
    • Windows Server 2012R2 (15)
    • Windows Server 2016 (20)
    • Windows Server 2019 (10)

Subscribe to our newsletter

©2025 NKCODE TECH GEEK ZONE | Design: Newspaperly WordPress Theme
%d