How to run a fleet-wide operation on EC2 safely
何时使用: You need to patch or restart a group of instances matching a tag, without writing the whole script yourself.
前置条件
- Skill installed — git clone https://github.com/zxkane/aws-skills ~/.claude/skills/aws-skills
- aws CLI configured — aws configure or SSO profile
步骤
-
Dry-run the queryUse aws-skill. List EC2 instances tagged Env=staging, App=api. Just describe, don't mutate.✓ 已复制→ Table of instance IDs with state
-
Plan the actionNow propose the command to restart all running ones. Show me the exact aws cli call before running it.✓ 已复制→ Command printed; no execution yet
-
Execute with guardrailsExecute in batches of 3 with 30s between batches. Abort if any fails.✓ 已复制→ Batched output with success/failure per batch
结果: A controlled fleet operation with no unpleasant surprises.
注意事项
- Wrong profile/region destroys prod — Always echo the resolved profile + region as the first line of any action