StudyToCert

All certifications / Developer Associate / Lessons

AWS Certified Developer – Associate DVA-C02 · Domain 2: Security

AWS KMS: customer managed vs AWS managed keys, envelope encryption with GenerateDataKey, 4 KB Encrypt limit, cross-account key use

▶ Watch the overview video

Last reviewed October 6, 2026 · Leer en español

Explain it simpler

AWS Key Management Service, or KMS, is a very secure vault for master keys. The master keys never leave the vault. You can ask the vault to lock tiny things, up to about the size of a short text file, but not big files. For big files you use a trick called envelope encryption: ask the vault for a fresh small key, use that small key on your own computer to lock the big file, then keep a vault-locked copy of the small key next to the file and throw away the unlocked copy. To open the file later, ask the vault to unlock the small key. It is like locking a suitcase with a padlock and then putting the padlock's key in a bank safe.

Owen joins the data team at Riverside Insurance on a Monday, and his first ticket looks simple: encrypt the nightly claims export, about 50 MB, with the company's KMS key before it is archived. He writes three lines of code that call KMS Encrypt with the whole file. The job fails with a validation error about the plaintext being too long. A senior engineer glances at the stack trace and says, 'You never send the file to KMS. You send it a much smaller job.' What does she mean, and how does a 50 MB file get protected by a key that never leaves KMS?

AWS Key Management Service (KMS) creates and controls cryptographic keys whose key material never leaves KMS unencrypted. KMS keys live inside hardware security modules managed by AWS, and every use is an API call that IAM and the key policy authorize and that AWS CloudTrail records. Services such as Amazon S3, Amazon DynamoDB, AWS Lambda and AWS Secrets Manager call KMS for you when you turn on encryption, and your own code can call it directly through the SDK.

Free account

Keep reading for free

Create a free StudyToCert account to read the rest of this lesson: 7 more sections, 7 key terms, a real-world example, an exam tip and self-check questions. Every lesson, lab and practice test is free with an account.

Sign up free Log in

Study Developer Associate for free
A week-by-week plan with every lesson, quizzes, checkpoint tests, a practice exam and hands-on labs.
Open the Developer Associate study plan