Certopolis

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.

Written from these sources

Try 3 questions on this

Pick an answer to see why each option is right or wrong.

  1. A bank in a country with two AWS Regions stores customer statements in Amazon S3 in the primary Region and replicates them to a bucket in the second in-country Region for disaster recovery. The regulator requires the encryption keys for this data to be generated and held in the bank's own hardware security modules (HSMs) in its data centers, never in AWS. The bank must be able to make the data undecryptable by AWS at any time, and each Region must be able to decrypt its own copy. Which solution will meet these requirements?

    Right. In the game that’s Renown for your Security, Compliance, and Governance building.

    Not that one: C is right. In the game your Security, Compliance, and Governance building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    Custom key stores do not support multi-Region keys, so a key in one Region's external key store cannot be replicated to the other. Each Region therefore gets its own external key store backed by the bank's HSMs, and each bucket is encrypted under a key from its own Region's store, so either copy can be decrypted independently.

    Written from docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html

  2. A company's compliance team sets two requirements for a migration to AWS. • Objects in an Amazon S3 analytics bucket, which serves millions of reads and writes each hour, must be encrypted under keys whose material is protected by HSMs validated at FIPS 140-3 Level 3. • A code-signing application moving from the data center calls its keys through a PKCS #11 library and must keep them in HSMs that are dedicated to the company. The company wants the lowest operational burden that meets both requirements. Which combination of steps should a solutions architect take to meet these requirements? (Select TWO.)

    Right. In the game that’s Renown for your Security, Compliance, and Governance building.

    Not that one: A,E is right. In the game your Security, Compliance, and Governance building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    The signing application is different: it needs HSMs dedicated to the company and keeps calling its keys through PKCS #11. AWS CloudHSM provides single-tenant HSMs, and applications built on PKCS #11 can move to it with few changes, so the library is pointed at a CloudHSM cluster.

    Written from docs.aws.amazon.com/cloudhsm/latest/userguide/introduction.html

  3. A bank's retail division uses an AWS CloudHSM key store in AWS Key Management Service (AWS KMS). The key store is backed by cluster-retail and holds the KMS keys that encrypt the division's Amazon EBS volumes and Amazon RDS databases. A regulator now requires the wealth division, in the same AWS account and Region, to use KMS keys whose key material is held in HSMs separate from the retail division's. The wealth division's services must keep naming KMS keys in their encryption settings. The platform team wants to reuse as much of cluster-retail's setup as possible. Which combination of steps should a solutions architect take to meet these requirements? (Select TWO.)

    Right. In the game that’s Renown for your Security, Compliance, and Governance building.

    Not that one: A,D is right. In the game your Security, Compliance, and Governance building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    AWS KMS judges that by backup history: a cluster restored from cluster-retail's backup counts as the same lineage and cannot back a second key store. So the wealth division gets a cluster built from scratch, with two active HSMs in different Availability Zones so that keys can be created in it, and a new key store associated with that cluster. The division's KMS keys are then created in the new key store and named in EBS and RDS settings as usual.

    Written from docs.aws.amazon.com/kms/latest/developerguide/keystore-cloudhsm.html

Ask for something