What Is AWS KMS? Use Data Keys to Encrypt Data and Control Access
AWS Key Management Service (AWS KMS) is a managed service that helps AWS services and applications create cryptographic keys, control who may use them, and audit key use. For ordinary bulk encryption, a KMS key usually protects a data key instead of encrypting the data itself. When adopting KMS, plan not only the cryptography but also who can use each key, how the application handles data keys, and whether data can be recovered after a key is disabled or deleted.
AWS Key Management Service (AWS KMS) is a managed service that helps AWS services and applications create cryptographic keys, control who may use them, and audit key use. For ordinary bulk encryption, a KMS key usually protects a data key instead of encrypting the data itself. When adopting KMS, plan not only the cryptography but also who can use each key, how the application handles data keys, and whether data can be recovered after a key is disabled or deleted.
This article explains AWS KMS as verified on November 19, 2026. It does not assume that other cloud providers use the same names or behavior.
What does a KMS key do?
A KMS key is a logical key resource at the center of cryptographic operations and access control in AWS KMS. A customer managed key lets an account manage its policies and lifecycle. An AWS managed key is managed by an AWS service in the customer account, while an AWS owned key is owned and managed by an AWS service. The type affects operational responsibilities such as editing the key policy, sharing across accounts, and configuring rotation.
A symmetric encryption KMS key encrypts and decrypts with the same secret key material, but the material is not downloaded in plaintext for an application to use directly. The caller authenticates with AWS credentials and must pass KMS authorization policies; KMS performs the cryptographic operation. AWS says it provides no mechanism to export plaintext KMS key material. Access to a KMS key is therefore an important control over the data it protects.
The Encrypt API can directly process up to 4,096 bytes of plaintext in one call. For a large file or collection of database records, use envelope encryption with data keys instead of trying to encrypt the entire payload with this operation.
How does envelope encryption work?
Envelope encryption protects data with a data key, then encrypts that data key under a KMS key. The application or encryption library handles the data locally, while AWS KMS protects the data key. Store the ciphertext and encrypted data key together; later, an authorized caller can decrypt the data key and recover the original data.
A typical flow is:
The application calls `GenerateDataKey` to request a symmetric data key. KMS returns a plaintext copy for immediate use and a copy encrypted under the KMS key.
The application encrypts the actual data with the plaintext data key. This cryptographic operation happens outside KMS; remove the plaintext key from memory as soon as possible afterward.
The application stores the encrypted data and encrypted data key together. It does not store the plaintext data key.
To decrypt, the application sends the encrypted data key to KMS `Decrypt`. If authorized, it receives the plaintext data key, decrypts the data, and removes the key from memory again.
For example, suppose a service stores customer report files. It could generate a data key for each file, encrypt the file contents, and store the encrypted copy of the data key with the file metadata. When the file is read, the service role needs KMS permission to decrypt that data key. If the key policy blocks that role from decrypting, the stored file ciphertext remains, but the service cannot obtain the data key to read it. This hypothetical example shows both the strength of access control and how a key-policy change can affect service availability.
AWS KMS can generate, encrypt, and decrypt data keys, but it does not store, track, or use them to encrypt the data itself. The application is responsible for safely handling plaintext data keys in memory, storing encrypted keys with ciphertext, and performing local encryption. To reduce implementation mistakes, consider a vetted library such as the AWS Encryption SDK instead of inventing a cryptographic protocol.
Who can use a KMS key?
Every KMS key must have a key policy. This resource policy attached to the key is the primary way to control access. IAM policies can also be used, but an IAM allow does not grant key access unless the key policy permits delegation to IAM. Grants can delegate access needed by a service or task without changing the key policy.
Separate key administration from cryptographic use. For example, key administrators can manage policies or schedule deletion, while an application role receives only the necessary cryptographic operations on the specific key it needs. Restrict policy-editing permissions carefully because they can enable new principals to access the key. Key policies are Regional: a policy in one Region does not control a key in another Region.
Also verify which key the cryptographic operation actually uses and which permissions the application has. If access depends on aliases or resource tags, permission to change those can also change effective key access. CloudTrail records can help review KMS key administration and use.
How are rotation, disabling, and deletion different?
Key rotation replaces the cryptographic key material of the same logical KMS key. For eligible keys, the key ID and policy remain, and KMS decrypts ciphertext created with earlier material using the appropriate version. Rotation does not automatically replace application data keys or re-encrypt all stored data. Do not assume that rotating KMS key material resolves exposure of a compromised data key.
As verified on November 19, 2026, customer managed symmetric encryption keys using key material generated by AWS KMS can opt into automatic rotation, with a default period of 365 days. AWS managed keys are rotated annually by AWS KMS. Asymmetric keys, HMAC keys, and keys in custom key stores are not eligible for automatic rotation; when rotation is needed, a manual process may require creating a new key and updating its users and policies. Available rotation methods depend on key type and material origin, so check the key's actual configuration.
Disabling keeps a key recoverable while stopping cryptographic operations. Scheduling deletion is riskier. Customer managed keys have a 7-to-30-day waiting period. During that period the key cannot be used for cryptographic operations; after the period expires and deletion occurs, the key material and metadata cannot be restored. Ciphertext protected by a permanently deleted symmetric key may become unrecoverable. Before deletion, identify stored data and services that use the key, along with backup and audit-retention needs. If uncertain, consider disabling rather than deleting.
What should you check when adopting KMS or diagnosing a failure?
First decide what data and services need protection and whether an AWS managed key is sufficient or a customer managed key is required. Determine whether the data is small enough for direct KMS encryption or needs data keys and local encryption. Then separate administrators from application users in the key policy and allow only the necessary cryptographic operations. Document the Region, service role, rotation requirements, audit records, and recovery procedure as well.
When decryption fails, check systematically instead of repeatedly broadening permissions:
Identify the caller, key ARN or alias, and Region used by the request.
Check whether the key is enabled or pending deletion.
Confirm that the key policy allows the caller or IAM delegation, then review IAM policies and grants.
Confirm that the ciphertext uses the expected key and encryption context. If encryption context was used, the decrypt request must provide the same values.
Use CloudTrail to find denied requests and key-use history. Make a narrowly scoped policy change and verify it with a new request.
AWS KMS provides a foundation for centrally managing keys, connecting policies and audit to encryption in AWS services. Bulk data is often protected with envelope encryption, while the application must handle data keys and plaintext memory safely. Designing least-privilege key policies, understanding rotation versus deletion, and planning for recovery limits help encryption protect data without undermining service continuity.
Sources
[AWS: AWS KMS concepts](https://docs.aws.amazon.com/kms/latest/developerguide/concepts-intro.html)
[AWS: Cryptography essentials and envelope encryption](https://docs.aws.amazon.com/kms/latest/developerguide/kms-cryptography.html)
[AWS: Data keys](https://docs.aws.amazon.com/kms/latest/developerguide/data-keys.html)
[AWS: Key policies](https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html)
[AWS: Rotate KMS keys](https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html)
[AWS: Delete KMS keys](https://docs.aws.amazon.com/kms/latest/developerguide/deleting-keys.html)
[AWS API: Encrypt operation and 4,096-byte limit](https://docs.aws.amazon.com/kms/latest/APIReference/API_Encrypt.html)