Key material and HSMs
Imported versus KMS-generated key material, rotating and expiring imported keys, CloudHSM clusters, and KMS custom key stores backed by CloudHSM or an external key manager.
Exam tasks: 5.2.1 (choose between CloudHSM and KMS), 5.3.2 (import and remove key material, external key stores), 5.3.3 (imported versus AWS generated key material)
The decision: where must the key material be created, where must it live, who can destroy it, and how much availability and operational work are you willing to take on to get that control?
The ladder of control
- KMS, AWS generatedorigin AWS_KMS
KMS creates, stores, rotates and backs up the material in its multi-tenant FIPS 140-3 Level 3 HSMs. You control the policy.
- KMS, imported (BYOK)origin EXTERNAL
You generate the material and import a copy. You can expire or delete it instantly, and you keep the master copy.
- CloudHSM key storeorigin AWS_CLOUDHSM
KMS keys whose material lives in a CloudHSM cluster you own. Single-tenant, still works with AWS services.
- External key store (XKS)origin EXTERNAL_KEY_STORE
Material never enters AWS. Every encrypt and decrypt goes to your key manager outside AWS.
- CloudHSM directPKCS#11, JCE, CNG
Your application talks to the HSM itself. No KMS integration with AWS services.
Imported vs AWS generated material
AWS generated (AWS_KMS) | Imported (EXTERNAL) | |
|---|---|---|
| Who creates the material | KMS HSMs | You, with your own entropy source |
| Key types | Symmetric, asymmetric, HMAC | Symmetric, asymmetric (except ML-DSA), HMAC |
| Automatic rotation | Yes (symmetric) | No |
| On-demand rotation | Yes | Yes, after you import new material (symmetric only) |
| Expiration | Never | Optional expiry date you choose |
| Remove material without deleting the key | Not possible | DeleteImportedKeyMaterial, effective at once |
| Waiting period to destroy | 7–30 days (delete the key) | None for the material; reimport restores it |
| Durability | AWS | You: lose your copy after it expires and the data is gone |
| Custom key stores | Supported | Not supported |
| Multi-Region | Material copied to replicas by KMS | You import the same material into each replica |
Exam signal
"We must be able to make the data unreadable immediately, and restore access later" means imported key material: delete the material now, reimport the same material later. Scheduling key deletion can't be undone after the waiting period, and disabling a key leaves the material inside AWS.
How import works
Create a key with no material. CreateKey with origin EXTERNAL. The key sits in PendingImport.
Download the wrapping public key and import token. GetParametersForImport returns an RSA public key and a
token that are valid for 24 hours.
Wrap your material. Encrypt it with the public key using RSAES-OAEP or RSA-AES key wrap, on your own HSM.
Import. ImportKeyMaterial with the token, the wrapped material and an optional expiration time.
- The ciphertext is bound to the KMS key, not just the material. If you delete the KMS key, importing the same material into a new key doesn't decrypt old data. Keep the key; only remove the material.
- Only the same material can be reimported into a key, unless you are staging new material for on-demand rotation.
- Set a CloudWatch alarm on the
SecondsUntilKeyMaterialExpirationmetric so an expiry doesn't surprise you. - When imported material expires or is deleted, the key becomes unusable. AWS services that cached a data key (an attached EBS volume, for example) keep working until the data key is needed again.
Rotating imported material
- Generate new material and import it into the same key. It shows as pending rotation.
- Call
RotateKeyOnDemand. New encryptions use the new material, and old ciphertext still decrypts with the old material, which stays attached to the key. - Every material version must stay present and unexpired. Losing any of them makes the whole key unusable.
Rotating BYOK the old way
Older material taught "create a new KMS key, import new material, move the alias" as the only way to rotate imported keys. That still works, but it leaves a second key to manage and applications that stored the key ARN break. On-demand rotation of imported material now keeps the same key ID.
AWS CloudHSM
- A cluster of single-tenant HSMs in your VPC, FIPS 140-3 Level 3 validated. AWS manages the hardware, patching and backups; you manage HSM users, keys and policies. AWS can't see or recover your keys.
- Put at least two HSMs in different Availability Zones. Keys synchronise across the cluster, and a lone HSM is a single point of failure.
- CloudHSM takes automatic encrypted backups at least once a day. You can copy backups to another Region for DR.
- Users on the HSM: admins manage users; crypto users create and use keys. Lose all admin credentials and nobody, including AWS, can recover access.
- Access is through the client SDK: PKCS#11, JCE, OpenSSL Dynamic Engine, and KSP/CNG on Windows.
| Signal in the question | Why CloudHSM |
|---|---|
| Oracle TDE or SQL Server TDE on EC2 with an HSM-held master key | Databases integrate through PKCS#11 or EKM, not KMS |
| TLS offload on web servers with the private key in an HSM | NGINX, Apache or IIS integration |
| Root key of a Windows or self-run certificate authority | CNG or PKCS#11 |
| Contract requires single-tenant HSM and customer-only admin | Only you hold HSM admin credentials |
| Symmetric algorithms or key types KMS doesn't offer | Direct HSM API |
FIPS alone doesn't mean CloudHSM
KMS HSMs are already FIPS 140-3 validated, and KMS offers FIPS endpoints. "Must use FIPS-validated cryptography" is satisfied by KMS. Choose CloudHSM only when the question adds single tenancy, customer-exclusive control, or an interface such as PKCS#11.
KMS custom key stores
CloudHSM key store
- KMS keys whose material is generated and kept in your CloudHSM cluster. KMS calls the cluster as a special
crypto user named
kmsuser. - The cluster must have at least two active HSMs in different AZs before KMS can connect.
- Supports symmetric encryption keys only. No automatic or on-demand rotation, no imported material, no multi-Region keys.
- AWS services integrate exactly as with any customer managed key. Every use also appears in the HSM audit logs.
- If the cluster loses its HSMs or you disconnect the key store, the keys become unavailable until you fix it.
External key store (XKS)
- KMS keys backed by a key manager outside AWS: an on-premises HSM, another cloud, or a vendor service. KMS never sees your external key.
- KMS talks to an XKS proxy that you run, over a public endpoint or a VPC endpoint service (preferred when you want traffic off the internet).
- Double encryption: KMS encrypts with its own per-key material, then your key manager encrypts again, so neither side alone can decrypt.
- Disconnect the key store (or cut the proxy) and every dependent AWS resource loses access to its keys. This is the "kill switch" some sovereignty regulations demand.
- You own availability, latency (aim for a round trip under 35 ms to the Region) and durability. Symmetric keys only, and no rotation of the KMS key itself.
| KMS standard | CloudHSM key store | External key store | CloudHSM direct | |
|---|---|---|---|---|
| Tenancy | Multi-tenant HSMs | Single-tenant | Your own system | Single-tenant |
| Works with S3, EBS, RDS... | Yes | Yes | Yes | No |
| Material inside AWS | Yes | Yes, in your cluster | No | Yes, in your cluster |
| Who keeps it available | AWS | You (cluster size, AZs) | You (proxy, network, HSM) | You |
| Rotation | Automatic or on demand | Manual only | In your key manager | You script it |
Scenarios
An external key store keeps the key material in the insurer's HSMs, and disconnecting it cuts AWS off. Imported material is a copy that does reside in AWS. A CloudHSM key store keeps the material in AWS-hosted hardware. SSE-C doesn't exist for EBS, and client-side EBS encryption isn't a native feature.
KMS supports on-demand rotation of imported material: import new material into the same key, then rotate, and the ARN stays the same while old ciphertext still decrypts. Automatic rotation isn't available for imported material. A new key changes the ARN. Replacing material outright isn't allowed and would orphan existing ciphertext.
Oracle TDE on EC2 uses PKCS#11 to reach an HSM, and CloudHSM gives single-tenant hardware administered only by the customer. A KMS key isn't single-tenant and Oracle TDE doesn't call KMS. An external key store puts the key outside AWS, which wasn't asked for, and Oracle still couldn't use it directly. Secrets Manager isn't an HSM.
Further reading
KMS key management
KMS key types and ownership, key policies, grants and condition keys, envelope encryption, rotation, multi-Region and cross-account keys, and safe deletion.
Encryption in transit
Load balancer TLS policies and where TLS terminates, mutual TLS, ACM and AWS Private CA across Regions, CloudFront protocol policies, inter-node encryption for EMR, EKS and SageMaker AI, Nitro encryption, and forcing TLS on AWS APIs.