One stray command. One profile mix-up. And the damage was instant.
The AWS CLI makes it dangerously easy to run powerful commands across multiple accounts with almost no guardrails. If you work with CLI-style profiles, you already know how effortless it is to switch environments—or to think you’ve switched—only to wreak havoc in production instead of staging.
The root problem is simple: AWS CLI profiles are just text in config. There’s no built-in confirmation for destructive commands. If the wrong --profile gets used, the CLI won’t stop to ask if you’re sure. A single aws s3 rm --recursive on the wrong bucket can erase terabytes before you realize it.
Why This Happens
AWS CLI supports multiple named profiles, each with its own access keys. You switch with the --profile flag or an environment variable. If you forget to pass the flag, it defaults to the profile last set. Any human in a hurry will eventually skip a double-check. Mistakes are inevitable because the CLI offers no direct, visible warning about where commands will run.
Real Risks
- Deleting live infrastructure instead of test resources.
- Overwriting production data during automated scripts.
- Incurring massive, unexpected AWS bills.
- Violating compliance rules by touching restricted data.
These are not rare edge cases. They are common enough that most experienced engineers have a story of profile confusion.