AWS Certified Solutions Architect – Professional
KMS custom key stores: CloudHSM vs external (XKS), SAP-C03
The AWS KMS guide says the standard key store already protects key material in FIPS 140-3 Level 3 validated HSMs and suits most workloads. An AWS CloudHSM key store keeps key material in a single-tenant CloudHSM cluster that you own inside AWS. An external key store keeps it in your own key manager outside AWS.
Start with the standard key store
In the standard key store, key material is generated in and protected by HSMs that are FIPS 140-3 Level 3 validated, and it never leaves them unencrypted. AWS describes these HSMs as a fleet that is not dedicated to one tenant. The standard store supports every KMS feature, gives the highest request rates and lowest latency, and has a 99.999% availability SLA. A requirement that names only FIPS 140-3 Level 3 is met here.
If you must show control over the key material itself, AWS suggests imported key material in the standard store first. You control how the material is generated and when it is deleted, and performance matches standard keys. Automatic rotation is not available for imported material.
AWS says to create a custom key store only when a regulation explicitly requires a single-tenant HSM or an HSM you control outside AWS. Custom key stores are not more secure than the standard store. They cost more, perform worse and make you responsible for availability.
AWS CloudHSM key store
When you create a KMS key in a CloudHSM key store, KMS generates a non-extractable 256-bit AES key in a CloudHSM cluster that you own and manage, and the cryptographic operations run in that cluster's HSMs. The key is still a KMS key. Services that support customer managed keys use it by its key ID as usual, with the same key policies, aliases and tags.
The cluster rules are strict. Each key store is associated with one cluster, and a cluster can be associated with only one key store. The cluster cannot share a backup history with a cluster that is associated with another key store. It must be in the same account and Region as the key store, and it needs at least two active HSMs in different Availability Zones before KMS can create keys in it. A second, separate key store therefore needs a cluster created new, not one restored from the first cluster's backup.
While the key store is disconnected, KMS cannot reach the cluster and its keys cannot be used. AWS rates CloudHSM key stores as low throughput with no SLA. They fit low-rate uses such as Amazon EBS volume and Amazon RDS database encryption, and AWS says not to use them for high-volume Amazon S3 operations, analytics services or DynamoDB. If a custom key store is required, AWS prefers this type over an external key store, because the path between KMS and the HSMs stays inside the AWS network.
External key store (XKS)
In an external key store, the key material is generated, stored and used in a key manager outside AWS that you own, such as HSMs in your data center. KMS never talks to the key manager directly. It sends requests to an external key store proxy that you provide. The proxy is reached either at a public endpoint over the internet or through an Amazon VPC endpoint service that you create.
This is the option that lets you cut AWS off. If you disconnect the key store, or disconnect the key manager from the proxy, AWS loses access to the keys and ciphertext under them cannot be decrypted until you restore the link. A permanent cut makes that ciphertext unrecoverable. The exception is services that briefly cache data keys.
Each KMS key is created with the ID of one external key, and that ID cannot be changed afterwards. The external key manager can rotate the key material behind that ID. KMS also encrypts the data first with its own key material, so the ciphertext is double encrypted.
External key stores have the lowest throughput and highest latency of the options, and you are responsible for the availability, durability and latency of key operations. AWS says they are not recommended unless there is an explicit, unchangeable requirement to keep key material outside AWS.
Limits of both custom key stores, and CloudHSM without KMS
Both types of custom key store support symmetric encryption KMS keys only. Asymmetric keys, HMAC keys, imported key material, automatic key rotation and multi-Region keys are not supported. Data kept in two Regions therefore needs a key store and a KMS key in each Region, because a key in a custom key store cannot be replicated. An account can have up to 10 custom key stores in a Region.
Some workloads should use AWS CloudHSM directly, with no KMS key involved. CloudHSM provides single-tenant HSMs where you choose the algorithms and keys, including asymmetric key pairs. Applications built on PKCS #11, JCE, CNG or KSP can move to it with fewer changes. Signing keys called through a PKCS #11 library belong here, since a CloudHSM key store holds only AES symmetric keys.
A CloudHSM cluster is a set of HSMs that the service keeps in sync. An operation on one HSM is carried to the others automatically. A cluster can have 1 to 28 HSMs. Spreading them across Availability Zones gives redundancy, and adding HSMs raises performance.
Where the exam catches people
- Believing a FIPS 140-3 Level 3 requirement needs CloudHSM: the standard KMS key store already uses HSMs validated at that level.
- Believing a multi-Region key can be created in a custom key store and replicated: multi-Region keys are not supported there, so each Region needs its own key store and key.
- Believing automatic rotation can be turned on for a key in a CloudHSM or external key store: custom key stores do not support it.
- Believing a cluster restored from another key store's cluster backup can back a second key store: the cluster must not share a backup history with one already associated.
- Believing a CloudHSM key store can hold asymmetric signing keys for a PKCS #11 application: it holds only symmetric keys, so that application uses a CloudHSM cluster directly.