$npx -y skills add giuseppe-trisciuoglio/developer-kit --skill aws-cli-beastProvides advanced AWS CLI patterns for managing EC2, Lambda, S3, DynamoDB, RDS, VPC, IAM, and CloudWatch. Generates bulk operation scripts, automates cross-service workflows, validates security configurations, and executes JMESPath queries for complex filtering. Triggers on "aws
| 1 | # AWS CLI Beast Mode |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Advanced AWS CLI patterns for speed, precision, and security-first automation. Covers JMESPath queries, bulk operations, waiters, cross-account access, and destructive operation safety. |
| 6 | |
| 7 | ## When to Use |
| 8 | |
| 9 | - Bulk operations across thousands of AWS resources |
| 10 | - Advanced JMESPath filtering and output transformation |
| 11 | - Automated scripts for AWS routines |
| 12 | - Multi-profile and multi-region management |
| 13 | - Security auditing and compliance checks |
| 14 | - CLI-driven infrastructure-as-code workflows |
| 15 | |
| 16 | ## Instructions |
| 17 | |
| 18 | ### Step 1: Categorize the Request |
| 19 | |
| 20 | | Category | Services | Commands | |
| 21 | |----------|----------|----------| |
| 22 | | Compute | EC2, Lambda | describe-instances, invoke, publish-version | |
| 23 | | Storage | S3 | sync, cp, mb, rb, presign | |
| 24 | | Database | DynamoDB, RDS | query, scan, batch-write-item | |
| 25 | | Networking | VPC, Route53 | describe-vpcs, describe-security-groups | |
| 26 | | Security | IAM | simulate-principal-policy, get-policy-version | |
| 27 | | Observability | CloudWatch | get-metric-statistics, filter-log-events | |
| 28 | |
| 29 | ### Step 2: Apply Beast Mode Principles |
| 30 | |
| 31 | 1. **Dry-run first**: Always validate with `--dryrun` or `--dry-run` |
| 32 | 2. **Query server-side**: Use `--query` with JMESPath to filter before transfer |
| 33 | 3. **Batch intelligently**: Paginate with `--max-results` and parallelize with xargs |
| 34 | 4. **Wait properly**: Use built-in waiters or exponential backoff polling |
| 35 | 5. **Switch contexts**: Use `--profile` and `--region` for multi-account operations |
| 36 | |
| 37 | ### Step 3: Validate Destructive Operations |
| 38 | |
| 39 | **MANDATORY** for any destructive operation: |
| 40 | |
| 41 | ```bash |
| 42 | # S3 sync with delete - MUST dry-run first |
| 43 | aws s3 sync s3://source/ s3://dest/ --delete --dryrun |
| 44 | # Review output, then remove --dryrun only if satisfied |
| 45 | |
| 46 | # Bulk EC2 stop - validate targets first |
| 47 | aws ec2 describe-instances \ |
| 48 | --filters "Name=tag:Environment,Values=development" \ |
| 49 | --query 'Reservations[].Instances[?State.Name==`running`].InstanceId' \ |
| 50 | --output text |
| 51 | # Confirm list, then pipe to stop command |
| 52 | |
| 53 | # IAM policy attachment - simulate first |
| 54 | aws iam simulate-principal-policy \ |
| 55 | --policy-source-arn arn:aws:iam::123456789012:user/myuser \ |
| 56 | --action-names s3:DeleteObject \ |
| 57 | --resource-arns arn:aws:s3:::my-bucket/* |
| 58 | ``` |
| 59 | |
| 60 | ### Step 4: Reference Detailed Guides |
| 61 | |
| 62 | - `compute-mastery.md` - EC2, Lambda, Spot Fleets, ASG |
| 63 | - `data-ops-beast.md` - S3 multipart, DynamoDB batch, RDS snapshots |
| 64 | - `networking-security-hardened.md` - VPC Flow Logs, IAM policies, security groups |
| 65 | - `automation-patterns.md` - Shell aliases, JMESPath templates, CI/CD integration |
| 66 | |
| 67 | ## Examples |
| 68 | |
| 69 | ### Example 1: Bulk EC2 Stop |
| 70 | |
| 71 | **"Stop all development instances"** |
| 72 | |
| 73 | ```bash |
| 74 | # 1. Dry-run: identify targets |
| 75 | aws ec2 describe-instances \ |
| 76 | --filters "Name=tag:Environment,Values=development" \ |
| 77 | "Name=instance-state-name,Values=running" \ |
| 78 | --query 'Reservations[].Instances[].InstanceId' \ |
| 79 | --output text |
| 80 | |
| 81 | # 2. Confirm IDs, then execute |
| 82 | aws ec2 describe-instances \ |
| 83 | --filters "Name=tag:Environment,Values=development" \ |
| 84 | "Name=instance-state-name,Values=running" \ |
| 85 | --query 'Reservations[].Instances[].InstanceId' \ |
| 86 | --output text | xargs aws ec2 stop-instances --instance-ids |
| 87 | ``` |
| 88 | |
| 89 | ### Example 2: S3 Migration with Encryption |
| 90 | |
| 91 | **"Migrate data between buckets with SSE"** |
| 92 | |
| 93 | ```bash |
| 94 | # 1. Dry-run migration |
| 95 | aws s3 sync s3://source-bucket/ s3://dest-bucket/ \ |
| 96 | --sse AES256 \ |
| 97 | --storage-class GLACIER \ |
| 98 | --exclude "*.tmp" \ |
| 99 | --dryrun |
| 100 | |
| 101 | # 2. Enable versioning on destination |
| 102 | aws s3api put-bucket-versioning \ |
| 103 | --bucket dest-bucket \ |
| 104 | --versioning-configuration Status=Enabled |
| 105 | |
| 106 | # 3. Execute after review |
| 107 | aws s3 sync s3://source-bucket/ s3://dest-bucket/ \ |
| 108 | --sse AES256 \ |
| 109 | --storage-class GLACIER \ |
| 110 | --exclude "*.tmp" |
| 111 | ``` |
| 112 | |
| 113 | ### Example 3: IAM Security Audit |
| 114 | |
| 115 | **"Find overprivileged IAM users"** |
| 116 | |
| 117 | ```bash |
| 118 | aws iam list-users --query 'Users[].UserName' --output text | \ |
| 119 | while read user; do |
| 120 | echo "Checking $user..." |
| 121 | aws iam simulate-principal-policy \ |
| 122 | --policy-source-arn "arn:aws:iam::123456789012:user/$user" \ |
| 123 | --action-names DeleteItem,DeleteTable,DeleteFunction \ |
| 124 | --resource-arns "*" \ |
| 125 | --query 'EvaluationResults[?EvalDecision==`allowed`]' |
| 126 | done |
| 127 | ``` |
| 128 | |
| 129 | ### Example 4: Multi-Region Lambda Deployment |
| 130 | |
| 131 | **"Deploy Lambda to all regions"** |
| 132 | |
| 133 | ```bash |
| 134 | for region in us-east-1 us-west-2 eu-west-1; do |
| 135 | echo "Deploying to $region..." |
| 136 | aws lambda update-function-code \ |
| 137 | --function-name my-function \ |
| 138 | --zip-file fileb://function.zip \ |
| 139 | --region $region \ |
| 140 | --pub |