aws-cli

asimihsan's avatarfrom asimihsan

AWS CLI commands for dev/stage/prod environments. Use when running any aws CLI command, interacting with S3, Lambda, Glue, Athena, CloudWatch, or other AWS services. Ensures correct profile and region are used per environment.

0stars🔀0forks📁View on GitHub🕐Updated Jan 5, 2026

When & Why to Use This Skill

This Claude skill streamlines AWS CLI operations across development, staging, and production environments. It provides a standardized framework for interacting with core AWS services like S3, Lambda, CloudWatch, and Glue, ensuring operational security and consistency by enforcing explicit profile and region configurations.

Use Cases

  • Multi-Environment Management: Seamlessly switch between dev, stage, and prod profiles to execute commands without the risk of environment cross-contamination.
  • S3 Data Operations: Efficiently list, sync, and transfer files across S3 buckets using optimized CLI patterns and recursive commands.
  • Serverless Resource Monitoring: Invoke Lambda functions, retrieve configurations, and monitor execution results directly through the agent.
  • Log Analysis and Debugging: Tail and filter CloudWatch logs in real-time to identify errors or monitor application performance across different regions.
  • Data Catalog Exploration: Query AWS Glue databases and table schemas to assist in data engineering and ETL workflow management.
  • Identity Verification: Use STS caller identity checks to verify active IAM roles and permissions before executing sensitive infrastructure changes.
nameaws-cli
description|

AWS CLI Environment Configuration

Profiles and Regions

Environment Profile Region
dev platform-dev us-west-2
stage platform-stage us-west-2
prod platform-prod us-west-2

Always specify both profile and region explicitly:

aws --profile platform-prod --region us-west-2 <service> <command>

Environment Variables Alternative

For repeated commands or scripts:

export AWS_PROFILE=platform-prod
export AWS_REGION=us-west-2

aws s3 ls s3://my-bucket/

Or inline for a single command:

AWS_PROFILE=platform-prod aws s3 ls s3://my-bucket/

Common Patterns

S3

# List bucket contents
aws --profile platform-prod --region us-west-2 \
  s3 ls s3://bucket-name/prefix/ --recursive

# Copy file locally
aws --profile platform-prod --region us-west-2 \
  s3 cp s3://bucket-name/path/to/file.parquet ~/Downloads/

# Sync directory
aws --profile platform-prod --region us-west-2 \
  s3 sync s3://bucket-name/prefix/ ./local-dir/

Lambda

# List functions
aws --profile platform-prod --region us-west-2 \
  lambda list-functions --query 'Functions[].FunctionName'

# Invoke function
aws --profile platform-prod --region us-west-2 \
  lambda invoke \
    --function-name my-function \
    --payload '{"key": "value"}' \
    response.json

# Get function configuration
aws --profile platform-prod --region us-west-2 \
  lambda get-function-configuration \
    --function-name my-function

CloudWatch Logs

# List log groups
aws --profile platform-prod --region us-west-2 \
  logs describe-log-groups \
    --log-group-name-prefix /aws/lambda/

# Tail logs (requires aws cli v2)
aws --profile platform-prod --region us-west-2 \
  logs tail /aws/lambda/my-function --follow

# Filter log events
aws --profile platform-prod --region us-west-2 \
  logs filter-log-events \
    --log-group-name /aws/lambda/my-function \
    --start-time $(date -d '1 hour ago' +%s)000 \
    --filter-pattern "ERROR"

Glue

# List databases
aws --profile platform-prod --region us-west-2 \
  glue get-databases \
    --query 'DatabaseList[].Name' | jq -r '.[]'

# List tables
aws --profile platform-prod --region us-west-2 \
  glue get-tables \
    --database-name my-database \
    --query 'TableList[].Name'

# Get table schema
aws --profile platform-prod --region us-west-2 \
  glue get-table \
    --database-name my-database \
    --name my-table \
    --query 'Table.StorageDescriptor.Columns'

STS (Identity Check)

# Verify which identity/role you're using
aws --profile platform-prod --region us-west-2 \
  sts get-caller-identity

Output Formatting

JSON with jq

# Pretty print
aws ... | jq .

# Extract specific field
aws ... | jq -r '.Field.SubField'

# Filter arrays
aws ... | jq '.Items[] | select(.Status == "ACTIVE")'

Built-in Query

# Use --query for server-side filtering (faster for large responses)
aws ... --query 'Items[?Status==`ACTIVE`].Name' --output text

Output Formats

--output json   # Default, parseable
--output text   # Tab-separated, good for shell scripts
--output table  # Human-readable tables
--output yaml   # YAML format

Pagination

For commands that return paginated results:

# Automatic pagination (default in CLI v2)
aws --profile platform-prod --region us-west-2 \
  s3api list-objects-v2 \
    --bucket my-bucket \
    --prefix my-prefix/ \
    --query 'Contents[].Key'

# Manual pagination
aws ... --max-items 100 --starting-token $NEXT_TOKEN

Debugging

# Verbose output
aws --debug ...

# Dry run (supported by some commands)
aws ec2 run-instances ... --dry-run