Lesson 8 of 8 AWS KMS and AWS CloudHSM

Protecting Sensitive Processing with Nitro Enclaves and Attestation

This lesson explains how Nitro Enclaves provide an isolated environment for data that even the instance's administrators must not see, and how KMS releases keys only to an enclave that proves exactly what code it runs.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe the Nitro System's baseline protections.
  • Describe the characteristics of a Nitro Enclave.
  • Explain how attestation conditions in a key policy release keys only to a specific enclave image.

The Nitro System baseline

On Nitro-based instances, virtualization is offloaded to dedicated hardware and a minimal hypervisor. There is no mechanism for AWS operators to log in to the host or read instance memory. EBS and instance store data is encrypted, and traffic between supported instance types is encrypted automatically. NitroTPM and UEFI Secure Boot add measured and verified boot for the instance itself.

What an enclave is

An AWS Nitro Enclave is an isolated compute environment within an EC2 instance. The following list describes its characteristics.

  • A separate virtual machine carved from the parent instance's CPU and memory.
  • No persistent storage, no interactive access (no SSH), and no external networking.
  • The only channel is a local vsock connection to the parent instance; the parent can relay encrypted data but never sees plaintext inside.
  • Even root on the parent instance cannot read the enclave's memory.
True or false

Nitro Enclaves

Exam skills 5.1.3 · 5.2.1

Check the characteristics of a Nitro Enclave.

Log in to try this activity Interactive activities are free with an account.

Attestation and KMS

When it starts, the enclave can request an attestation document signed by the Nitro hypervisor. It contains measurements (PCRs) of the enclave image, kernel, application, the parent's IAM role and instance ID, and the certificate that signed the image. When the enclave calls KMS Decrypt, GenerateDataKey or GenerateRandom with this document as the Recipient, KMS returns the result encrypted to the enclave's public key, so the parent instance relaying the response cannot read it.

The key policy then makes decryption conditional on the enclave's identity:

{"Effect": "Allow",
 "Principal": {"AWS": "arn:aws:iam::111111111111:role/payments-parent-instance"},
 "Action": "kms:Decrypt",
 "Resource": "*",
 "Condition": {"StringEqualsIgnoreCase": {
   "kms:RecipientAttestation:ImageSha384": "8c1f2b...e4a9"}}}

The following diagram shows where plaintext can exist when a card tokenisation service decrypts data inside a Nitro Enclave.

Attestation-based key access for card tokenisation. Root on the parent instance only relays ciphertext; the Nitro Enclave running the approved image sends KMS a signed attestation document, and the key policy allows kms:Decrypt only when ImageSha384 or PCR0 matches, so plaintext exists only inside the enclave.
PCR0 is an alternative to ImageSha384.

Common uses

A Nitro Enclave is an isolated environment carved from an EC2 instance, with no persistent storage, no interactive access and no external networking. Even the instance's own administrators cannot see inside it. KMS key policies can require a cryptographic attestation that only the approved enclave code is running before they allow decryption.

This supports four common uses. ACM for Nitro Enclaves installs ACM certificates into an enclave for web servers such as NGINX, so the TLS private key never reaches the parent instance. Tokenisation and PII processing decrypts personal data only inside attested code. Signing and wallet keys are held where operators cannot extract them. In multi-party computation, each party verifies the attested code before sending its data. The following table summarises these uses.

UseHow enclaves help
TLS private keysACM for Nitro Enclaves installs ACM certificates into an enclave for web servers such as NGINX; the private key never reaches the parent
Tokenization and PII processingDecrypt and process personal data only inside attested code
Signing and wallet keysHold signing keys where operators cannot extract them
Multi-party computationParties verify the attested code before sending their data

Compared with CloudHSM, enclaves run your own code in isolation but are not a FIPS-validated HSM. If a requirement names an HSM or FIPS 140-3 Level 3 key storage, the answer is CloudHSM or KMS itself.

Match the pairs

What enclaves are used for

Exam skills 5.2.1

Match each enclave use with how the enclave helps.

Log in to try this activity Interactive activities are free with an account.
Worked example

A payment processor decrypts card data on EC2 to tokenize it. Auditors require that system administrators with root access to the instances cannot access card data in plaintext, and that only the approved tokenization code can decrypt it.

Run the tokenization code in a Nitro Enclave. Encrypt card data with a KMS key whose policy allows kms:Decrypt only when kms:RecipientAttestation:ImageSha384 (or PCR0) matches the approved enclave image. Root on the parent can relay ciphertext but never obtains the key or the plaintext.

Check yourself

How does KMS release a key only to an approved enclave?

Show answer

Key policy conditions on kms:RecipientAttestation keys match the enclave's measurements in a signed attestation document.

Exam Tips

Remember for the exam

  • Nitro Enclaves have no storage, no networking and no interactive access; they talk to the parent over vsock.
  • Attestation documents measure the enclave image (PCRs) and are signed by the Nitro hypervisor.
  • KMS key policies use kms:RecipientAttestation condition keys to release keys only to approved enclaves.
  • With a Recipient, KMS encrypts responses to the enclave's public key, hiding them from the parent.
  • ACM for Nitro Enclaves protects TLS private keys for web servers.
  • Enclaves are isolation, not an HSM; FIPS HSM requirements point to CloudHSM.