teluzia.Cloud Engineer · Day 72
CHAPTER 11 · AWS SECURITY AND GOVERNANCE

KMS encryption

4–5 hours including independent practice3 topics
LET’S MAKE THIS SIMPLE

What you’re learning today

KMS is a guarded key service; the encrypted object is the locked parcel, and the key policy controls access to the unlocking service. KMS keys can protect data keys used by services to encrypt larger data. Envelope encryption separates a data key from its encrypted copy. The application or integrated service handles data encryption while KMS protects key material and authorizes cryptographic operations. A KMS key policy is central to access for that key. IAM policies, grants, and key-policy delegation participate according to KMS rules. Encrypt permission and decrypt permission are distinct, and cross-account use requires suitable permissions on both sides.

Think of it this way

KMS is a guarded key service; the encrypted object is the locked parcel, and the key policy controls access to the unlocking service.

TOPIC 01 / 03Step by step

Keys and envelope encryption

KMS keys can protect data keys used by services to encrypt larger data. Envelope encryption separates a data key from its encrypted copy. The application or integrated service handles data encryption while KMS protects key material and authorizes cryptographic operations. For example, an S3 object encrypted with SSE-KMS needs applicable S3 access and KMS decrypt authorization for its read path.

WORKED EXAMPLE
An S3 object encrypted with SSE-KMS needs applicable S3 access and KMS decrypt authorization for its read path.

A service wants to encrypt a large archive. Instead of sending the whole archive through a key-management operation, it obtains a data key, uses that key with an appropriate encryption algorithm, and stores the archive ciphertext alongside an encrypted copy of the data key. It discards the plaintext key when no longer needed. Reading reverses the process under authorized access.

Ciphertext is encrypted data. A data key encrypts the actual content. Envelope encryption protects that data key under a separate key-management key. KMS is therefore one part of a complete encryption design, not a replacement for storage permissions or safe application cryptography. An AWS-integrated service can perform much of this flow for you. The exact encryption context and authorization matter for decryption. Protect plaintext key material in memory and avoid logging it; encrypting the stored archive does not prevent a compromised authorized application from exposing decrypted content while it processes the data.

Why this matters

An S3 object encrypted with SSE-KMS needs applicable S3 access and KMS decrypt authorization for its read path.

A common trap

Do not overlook this operational distinction: The application or integrated service handles data encryption while KMS protects key material and authorizes cryptographic operations.

Read all topics in this lesson

A complete reference to revisit alongside the guided steps above.

Keys and envelope encryption

KMS keys can protect data keys used by services to encrypt larger data. Envelope encryption separates a data key from its encrypted copy. The application or integrated service handles data encryption while KMS protects key material and authorizes cryptographic operations. For example, an S3 object encrypted with SSE-KMS needs applicable S3 access and KMS decrypt authorization for its read path.

WORKED EXAMPLE
An S3 object encrypted with SSE-KMS needs applicable S3 access and KMS decrypt authorization for its read path.

A service wants to encrypt a large archive. Instead of sending the whole archive through a key-management operation, it obtains a data key, uses that key with an appropriate encryption algorithm, and stores the archive ciphertext alongside an encrypted copy of the data key. It discards the plaintext key when no longer needed. Reading reverses the process under authorized access.

Ciphertext is encrypted data. A data key encrypts the actual content. Envelope encryption protects that data key under a separate key-management key. KMS is therefore one part of a complete encryption design, not a replacement for storage permissions or safe application cryptography. An AWS-integrated service can perform much of this flow for you. The exact encryption context and authorization matter for decryption. Protect plaintext key material in memory and avoid logging it; encrypting the stored archive does not prevent a compromised authorized application from exposing decrypted content while it processes the data.

Why this matters

An S3 object encrypted with SSE-KMS needs applicable S3 access and KMS decrypt authorization for its read path.

A common trap

Do not overlook this operational distinction: The application or integrated service handles data encryption while KMS protects key material and authorizes cryptographic operations.

Key policies and grants

A KMS key policy is central to access for that key. IAM policies, grants, and key-policy delegation participate according to KMS rules. Encrypt permission and decrypt permission are distinct, and cross-account use requires suitable permissions on both sides. For example, a backup writer can encrypt data while a separate restore role receives scoped decrypt permission for recovery.

WORKED EXAMPLE
A backup writer can encrypt data while a separate restore role receives scoped decrypt permission for recovery.

A backup service writes encrypted data, while a restore operator later needs to decrypt it. The operator's identity permission is only one part of KMS authorization. The key policy must support the appropriate delegation or permission, and any applicable deny or cross-account restriction must be considered. A successful backup does not establish that the emergency restore identity can use the key.

A key policy is the resource policy attached to a KMS key. A grant is a KMS authorization mechanism often used by integrated services for specific operations. An encryption context is additional authenticated context associated with supported encryption operations, not a secret password. Separate write and restore permissions where operationally appropriate, then test the actual recovery role. Broad kms:* permission may exceed the requirement and still fail when the key-side policy does not authorize the request. Inventory key ownership and region alongside backup locations because those dependencies determine whether recovery access remains possible.

Why this matters

A backup writer can encrypt data while a separate restore role receives scoped decrypt permission for recovery.

A common trap

Do not overlook this operational distinction: Encrypt permission and decrypt permission are distinct, and cross-account use requires suitable permissions on both sides.

Rotation and key lifecycle

Rotation changes cryptographic material under supported key configurations without rewriting every previously encrypted object. Disabling a key can break dependent reads, and scheduling deletion is a serious data-recovery decision. Inventory dependent data and recovery access before lifecycle changes. For example, a rotated symmetric key can still decrypt older ciphertext through retained prior material; deleting the key can make protected data unrecoverable.

WORKED EXAMPLE
A rotated symmetric key can still decrypt older ciphertext through retained prior material; deleting the key can make protected data unrecoverable.

A supported symmetric KMS key rotates its cryptographic material. New encryption uses the current material while the service retains previous material necessary to decrypt earlier ciphertext. The logical key identity remains stable, so applications typically keep referring to the same key ARN. This is different from manually replacing the key identity or copying data under another key.

Rotation changes key material according to the key's supported configuration. Disabling stops cryptographic use while retaining the key. Scheduled deletion starts a process that can permanently remove the ability to decrypt dependent data. Rotation does not repair leaked plaintext or remove excessive permissions. Before retiring a key, find every data set, backup, and cross-account dependency protected by it. A low monthly key charge is not a reason to delete an unidentified key. The recovery trade-off is severe: storage may still exist in perfect condition while the missing key makes its encrypted contents unusable.

Why this matters

A rotated symmetric key can still decrypt older ciphertext through retained prior material; deleting the key can make protected data unrecoverable.

A common trap

Do not overlook this operational distinction: Inventory dependent data and recovery access before lifecycle changes.

KEEP THESE WITH YOU

Today’s takeaways

Keys and envelope encryption: KMS keys can protect data keys used by services to encrypt larger data. Envelope encryption separates a data key from its encrypted copy. The application or integrated service handles data encryption while KMS protects key material and authorizes cryptographic operations.

Key policies and grants: A KMS key policy is central to access for that key. IAM policies, grants, and key-policy delegation participate according to KMS rules. Encrypt permission and decrypt permission are distinct, and cross-account use requires suitable permissions on both sides.

Rotation and key lifecycle: Rotation changes cryptographic material under supported key configurations without rewriting every previously encrypted object. Disabling a key can break dependent reads, and scheduling deletion is a serious data-recovery decision. Inventory dependent data and recovery access before lifecycle changes.

CLOSE THE LOOP

Ready to complete this day?

Verify the practical steps and pass the knowledge check (at least two thirds correct).

Lab steps verifiedKnowledge check passed