agentleFS
lyhcodelyhcode/agent-skills/skills/awscli/SKILL.md

awscli

Skill2 starsChanged 8 months agoMITView on GitHub

Manage AWS services using the AWS CLI (aws command). Use when the user wants to interact with AWS services from the command line, including S3, EC2, IAM, Lambda, CloudFormation, ECS, SSM, Secrets Manager, DynamoDB, SQS, CloudWatch Logs, and more. Triggers on mentions of AWS, aws cli, S3, EC2, Lambda, or any AWS service management.

  • Reads credentials
  • Installs packages

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use --filters first to reduce data, then --query for formatting:

    line 124
  2. Distinctive:

    Use waiters: instead of polling in scripts

    line 258

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

AWS CLI Assistant

Help users manage AWS services using the aws CLI (v2).

Prerequisites

  • AWS CLI v2 installed (brew install awscli on macOS, or see reference/commands.md)
  • Credentials configured via aws configure, environment variables, SSO, or IAM role
  • Verify setup: aws sts get-caller-identity

Command Structure

aws <service> <command> [subcommand] [options]

Configuration

Files

  • ~/.aws/credentials — access keys (profile names without profile prefix)
  • ~/.aws/config — region, output, SSO settings (named profiles use [profile name])
# ~/.aws/credentials
[default]
aws_access_key_id=AKIAIOSFODNN7EXAMPLE
aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

# ~/.aws/config
[default]
region=us-west-2
output=json

[profile staging]
region=us-east-1
output=table

Key Environment Variables

VariablePurpose
AWS_ACCESS_KEY_IDAccess key
AWS_SECRET_ACCESS_KEYSecret key
AWS_SESSION_TOKENTemporary session token
AWS_DEFAULT_REGION / AWS_REGIONDefault region
AWS_PROFILENamed profile to use
AWS_PAGERPager program (set "" to disable)

Profiles

aws s3 ls --profile staging          # Use specific profile
export AWS_PROFILE=staging           # Set for session
aws configure list-profiles          # List all profiles
aws configure list                   # Show active config with sources

Credential Precedence

  1. CLI options → 2. Environment variables → 3. SSO → 4. ~/.aws/credentials → 5. ~/.aws/config → 6. Container/EC2 instance role

SSO (Recommended for Human Users)

[profile dev]
sso_session = my-sso
sso_account_id = 111122223333
sso_role_name = SampleRole
region = us-west-2

[sso-session my-sso]
sso_region = us-east-1
sso_start_url = https://my-sso-portal.awsapps.com/start
sso_registration_scopes = sso:account:access
aws sso login --profile dev

Output & Filtering

Output Formats

--output json|yaml|text|table (default: json)

JMESPath Filtering (--query)

# Get specific fields as table
aws ec2 describe-instances \
    --query 'Reservations[*].Instances[*].{ID:InstanceId,Type:InstanceType,State:State.Name}' \
    --output table

# Filter by condition
aws ec2 describe-volumes --query 'Volumes[?Size > `50`].{ID:VolumeId,Size:Size}'

# Get single value as text
aws ec2 describe-instances --query 'Reservations[0].Instances[0].InstanceId' --output text

# Sort and limit
aws ec2 describe-images --owners self \
    --query 'reverse(sort_by(Images,&CreationDate))[:5].{ID:ImageId,Date:CreationDate}'

Server-Side Filtering

Use --filters first to reduce data, then --query for formatting:

aws ec2 describe-instances \
    --filters "Name=instance-state-name,Values=running" "Name=tag:Env,Values=prod" \
    --query 'Reservations[*].Instances[*].[InstanceId,InstanceType]' --output text

Pagination

--no-paginate              # First page only
--page-size 100            # Items per API call (reduces timeouts)
--max-items 50             # Total items limit
--starting-token <token>   # Resume from NextToken
--no-cli-pager             # Disable pager for this command

Parameter Input

# From file (text)
aws ec2 run-instances --cli-input-json file://params.json

# From file (binary)
aws lambda update-function-code --zip-file fileb://function.zip

# Generate skeleton
aws ec2 run-instances --generate-cli-skeleton input > params.json

# Shorthand syntax
aws ec2 create-tags --resources i-123 --tags Key=Name,Value=MyServer Key=Env,Value=prod

Common Patterns

S3

aws s3 ls                                        # List buckets
aws s3 ls s3://bucket --recursive --human-readable --summarize
aws s3 cp file.txt s3://bucket/                   # Upload
aws s3 cp s3://bucket/file.txt ./                 # Download
aws s3 sync ./dir s3://bucket/dir --delete        # Sync with delete
aws s3 presign s3://bucket/file --expires-in 300  # Presigned URL
aws s3 rm s3://bucket/ --recursive                # Delete all objects

EC2

aws ec2 describe-instances --filters "Name=instance-state-name,Values=running"
aws ec2 run-instances --image-id ami-xxx --instance-type t3.micro --key-name mykey
aws ec2 stop-instances --instance-ids i-xxx
aws ec2 start-instances --instance-ids i-xxx
aws ec2 terminate-instances --instance-ids i-xxx

IAM & STS

aws sts get-caller-identity                       # Who am I?
aws iam list-users
aws iam create-role --role-name MyRole --assume-role-policy-document file://trust.json
aws iam attach-role-policy --role-name MyRole --policy-arn arn:aws:iam::aws:policy/...
aws sts assume-role --role-arn arn:aws:iam::123456789012:role/MyRole --role-session-name sess1

Lambda

aws lambda invoke --function-name my-func --payload '{"key":"val"}' out.json
aws lambda update-function-code --function-name my-func --zip-file fileb://code.zip
aws lambda list-functions

CloudWatch Logs

aws logs tail /aws/lambda/my-func --follow --since 5m
aws logs filter-log-events --log-group-name /aws/lambda/my-func --filter-pattern "ERROR"

SSM Parameter Store & Secrets Manager

aws ssm get-parameter --name /app/config/key --with-decryption
aws ssm put-parameter --name /app/config/key --type SecureString --value "secret"
aws ssm get-parameters-by-path --path /app/ --recursive --with-decryption
aws secretsmanager get-secret-value --secret-id MySecret
aws secretsmanager create-secret --name MySecret --secret-string file://creds.json

Waiters

Block until a resource reaches a desired state:

aws ec2 wait instance-running --instance-ids i-xxx
aws cloudformation wait stack-create-complete --stack-name my-stack

Global Options

OptionDescription
--regionAWS region
--profileNamed profile
--outputOutput format
--queryJMESPath filter
--no-cli-pagerDisable pager
--no-paginateFirst page only
--debugDebug logging to stderr
--dry-runValidate without executing (EC2, etc.)
--no-sign-requestSkip signing (public resources)
--endpoint-urlCustom endpoint (LocalStack, etc.)

Return Codes

CodeMeaning
0Success
252Invalid syntax or parameter
253Invalid credentials/config
254Service returned an error
255General failure

Best Practices

  1. Use SSO or IAM roles — avoid long-term access keys
  2. Use --query + --output text for scriptable output
  3. Combine server-side --filters with client-side --query for efficiency
  4. Use file:// for JSON params — avoids shell quoting issues and keeps secrets out of process lists
  5. Use --generate-cli-skeleton to discover parameter structure
  6. Use waiters instead of polling in scripts
  7. Set AWS_PAGER="" in scripts to prevent pager blocking

For complete service command reference, see reference/commands.md.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.