AWS Builder Center

5 Encryption and Secrets Mistakes AWS Beginners Make

Where encryption and secrets handling actually breaks in AWS — unencrypted volumes, hardcoded credentials, loose KMS policies — and how to fix each.

A lot of ransomware and data leak stories share the same root cause once you dig into the postmortem: something that should've been encrypted wasn't, or a secret that should've been locked away was sitting in plain text somewhere it shouldn't have been. Not a sophisticated attack — just a gap that was there the whole time.
The good news is encryption in AWS is mostly free and mostly a matter of flipping the right setting at the right time, not writing custom crypto code. Here are 5 mistakes that show up constantly, and how to fix each one.

1. Unencrypted EBS volumes and RDS databases

EBS volumes (the disks attached to your EC2 instances) and RDS databases aren't encrypted by default unless you turn it on — or unless your account has the account-level default enabled. If someone creates a volume or database without thinking about it, it just... stays unencrypted, silently, until someone notices during an audit (or worse, after an incident).
Fix it:
  • Enable EBS encryption by default at the account level (Settings, per region) so every new volume is encrypted automatically, with zero extra effort per resource.
  • For RDS, enable encryption at creation time — it can't be turned on for an existing unencrypted database without recreating it, so this is one you want to get right from the start.
  • For anything already unencrypted, you'll need to snapshot, copy with encryption enabled, and restore from the encrypted copy. Annoying, but a one-time fix.

2. Secrets hardcoded or sitting in environment variables

Database passwords, API keys, third-party tokens — these end up in places they shouldn't constantly: committed to source code, dropped into a  .env  file that gets committed anyway, or set as plain environment variables on an EC2 instance or Lambda function where anyone with read access to that resource can see them.
Environment variables aren't inherently evil, but they're not a vault either — they show up in console output, logs, and to anyone with sufficient IAM permissions to describe the resource.
Fix it:
  • Use Secrets Manager or Parameter Store (the SecureString type) to store secrets, and pull them at runtime instead of baking them in.
  • Grant access to those secrets via IAM policies scoped to exactly the roles that need them — same least-privilege logic as everything else.
  • Turn on automatic rotation in Secrets Manager for things like database credentials, so a leaked secret has a shorter useful life even if nobody notices right away.

3. KMS key policies that are too permissive

KMS (Key Management Service) manages the encryption keys behind most of this, and a key is only as protective as the policy controlling who can use it. A common mistake is a key policy that grants broad access — sometimes without realizing that a key policy interacts with IAM policies in a way that's a bit different from other AWS services.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": { "AWS": "*" },
"Action": "kms:*",
"Resource": "*"
}
]
}

That policy, taken alone, would let any principal with IAM permission to use KMS actions do whatever they want with the key — which defeats a lot of the point of encrypting things in the first place if the key itself isn't locked down.
Fix it:
  • Scope key policies to specific roles or users, not  "AWS": "*" .
  • Separate who can manage a key (create, disable, schedule deletion) from who can use it (encrypt/decrypt) — these should usually be different principals.
  • Review key policies with the same scrutiny you'd give an IAM policy, since a loose key policy can undermine encryption applied everywhere else.

4. No key rotation

Keys that never rotate mean that if one is ever compromised, the exposure window is indefinite. AWS KMS supports automatic annual rotation for customer-managed keys, and it costs nothing extra to enable — yet it's frequently just left off because it wasn't part of the initial setup checklist.
Fix it:
  • Turn on automatic key rotation for customer-managed KMS keys (one checkbox, no application changes needed since the key ID stays the same).
  • For secrets themselves (not just the KMS keys protecting them), use Secrets Manager's rotation feature, which can actually update the credential on the target resource (like an RDS password) on a schedule, not just the key wrapping it.

5. Treating "encrypted" as "done"

This is more of a mindset mistake than a technical one, but it causes real problems: encryption at rest doesn't protect against a compromised IAM role that has legitimate decrypt permissions, or an application with a SQL injection vulnerability reading data it's authorized to read anyway. Encryption protects against specific threats — someone getting raw access to the underlying storage, a stolen disk, unauthorized access to a snapshot — not against every possible way data can be exposed.
Fix it:
  • Think of encryption as one layer, not the whole strategy. Pair it with the IAM scoping and network controls from the other posts in this series.
  • Log KMS key usage (CloudTrail captures this) so you have visibility into who's actually decrypting data, not just who theoretically could.
  • Periodically review who has decrypt permissions on sensitive keys — permissions granted for a one-time migration or debugging session have a way of never getting removed.

The short version

Mistake
Fix
Unencrypted EBS/RDS
Enable encryption by default, encrypt at creation
Secrets hardcoded or in env vars
Secrets Manager / Parameter Store, pulled at runtime
Overly permissive KMS key policies
Scope to specific principals, separate manage vs. use
No key rotation
Turn on automatic rotation (KMS keys and secrets both)
Treating encryption as the whole solution
Pair with IAM scoping, log usage, review access regularly
None of this requires understanding the cryptography under the hood — AWS handles that part. It's really about not skipping the checkboxes that are sitting right there in the console, and not assuming something is protected just because "AWS encrypts stuff by default" in general terms.
If you're setting up a new project, go through this list before your first database or volume gets created — retrofitting encryption after the fact is a lot more work than doing it from day one.
Working through a specific case — cross-account KMS access, encrypting existing unencrypted resources, secret rotation for a custom app? Drop a comment.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article