1. Home
  2. Training Library
  3. Amazon Web Services
  4. Courses
  5. Manage Your Own Encryption Keys Using AWS CloudHSM

Using CloudHSM as a Custom Key Store in KMS

Start course

HSM stands for Hardware Security Module, but what is a hardware security module? It’s a physical tamper-resistant hardware appliance that is used to protect and safeguard cryptographic material and encryption keys.

The AWS CloudHSM service provides HSMs that are validated to Federal Information Processing Standards (FIPS) 140-2 Level 3, which is often required if you are going to be using your CloudHSM for document signing or if you intend to operate a public certificate authority for SSL certificates.

Learning Objectives

The objectives of this course are to explain:

  • What AWS CloudHSM is and does
  • The architecture of CloudHSM and its implementation
  • Access Control of your HSM Cluster
  • How to use CloudHSM as a custom key store in KMS, the Key Management Service
  • Monitoring and Logging

Intended Audience

This course is intended for anyone who is:

  • Responsible for protecting data stored within AWS
  • Looking to utilize a managed service to help perform cryptographic operations
  • Preparing for an AWS certification that requires you to have knowledge of securing data


To get the most out of this course, you should have a basic awareness of the fundamentals of AWS and some of its core services, such as VPC architecture. Some basic cryptography knowledge would also be beneficial, but not essential.



Hello and welcome to this lecture where I want to explain the interaction between the two AWS encryption services, AWS Key Management Service and AWS CloudHSM.

When working with AWS KMS, you are able to create custom key stores.  A key store is effectively a storage location which can store and protect your cryptographic keys used to encrypt and decrypt your data in AWS.  When working with AWS KMS, the default key stores are managed by KMS and are stored on HSMs managed by AWS, and so as a user of KMS you have no control over these HSMs which underpin the cryptographic storage of KMS.

However, if you have specific compliance controls that you need to adhere to, where you might require a greater level of control of your key stores.  By creating a custom key store you can leverage the power of your CloudHSM cluster which you have full management of, as explained in the previous lecture.  

A benefit of AWS KMS is that it has a wide range of integrations with other AWS services, allowing you to perform server-side encryption often at the click of a button with minimal configuration required.  This makes it a great choice when protecting your data.  

KMS creates and stores Customer Master Keys (CMKs) which is the main key type in KMS and there are two types of customer master keys. Firstly, those which are managed and created by you and I, as customers of AWS, which can be created by using KMS and then those that are managed and created by AWS themselves. 

CMKs that are generated and created by us as customers, rather than AWS, provide the ability to implement greater flexibility, such as being able to manage the key, including rotation, governing access and key policy configuration, along with being able to both enable and disable the key when it is no longer required. 

So, if within your organisation you want to use the seamless integration of KMS with many AWS services, but require the security and compliance of maintaining your own key material outside of KMS then you can create a custom key store backed by your CloudHSM cluster.

The custom key store is a resource managed from within KMS, but allows you to store your key material within your managed HSMs of your CloudHSM cluster.  This allows you to use the key material located within your HSM cluster to create the CMKs that KMS uses to implement encryption across different AWS services.  CMKs created from your custom key store are 256-bit, non-exportable AES symmetric keys that never leave the HSM unencrypted.  All cryptographic operations made with the CMK happens within the HSM cluster

So as you can see from this diagram, AWS services use CMKs managed by KMS using existing integration, but your CMKs can either come from the default key store created and stored by HSMs managed by AWS, or by using the custom key store which are managed by you allowing you to control access to your key material used within the CMKs.

Bear in mind that each HSM Cluster can only be associated with one custom key store for KMS, and both the cluster and the KMS creation of the custom key store must be within the same region.  KMS is a regional service, and keys can’t be used between multiple regions. If you want to create CMKs within your custom key store, then your cluster must have at least 2 HSMs activated in different availability zones.  

As a part of the process to create your custom key store you must upload the trust anchor certificate for the cluster to KMS, and this certificate is generated when the cluster is first initialized.  Also, you must create a dedicated Crypto User called kmsuser (without 2 factor authentication) and generate a password, which you then provide to KMS.  Going forward KMS will use this kmsuser CU to perform its operations in addition to rotating the password every time the user is authenticated.

About the Author
Stuart Scott
AWS Content Director
Learning Paths

Stuart has been working within the IT industry for two decades covering a huge range of topic areas and technologies, from data center and network infrastructure design, to cloud architecture and implementation.

To date, Stuart has created 90+ courses relating to Cloud reaching over 140,000 students, mostly within the AWS category and with a heavy focus on security and compliance.

Stuart is a member of the AWS Community Builders Program for his contributions towards AWS.

He is AWS certified and accredited in addition to being a published author covering topics across the AWS landscape.

In January 2016 Stuart was awarded ‘Expert of the Year Award 2015’ from Experts Exchange for his knowledge share within cloud services to the community.

Stuart enjoys writing about cloud technologies and you will find many of his articles within our blog pages.