Getting Started with AWS Key Management Service (KMS)

all aws aws kms aws security Jan 25, 2024

Introduction

AWS AWS KMS is a managed service designed to create and manage encryption keys. So what is Encryption, and what are these encryption keys? In this blog post, we will first discuss encryption and then the important concepts of the AWS KMS service. Consider this blog post as a starting point for your AWS KMS learning journey, and read all linked blog points in the See more section. Se let us get started with AWS KMS.

What is Encryption?

Encryption is a process that transforms readable data, typically referred to as plaintext, into a coded form, known as ciphertext, by using a set of characters called an encryption key. Decryption is the reverse process, where ciphertext is converted back to plaintext using a key, allowing authorized users to access the original information. This transformation ensures that sensitive information remains confidential and secure, as only individuals with the correct key can decrypt the data back into its original, readable form. We can read more about Encryption at secdops.com/blog/getting-started-with-encryption

Types of KMS Keys (Based on ownership)

Based on ownership, we can categorize the KMS keys into three types:

  • Customer Managed Keys are keys created and managed by us, the customer. We have full control, including key creation and management, and incur monthly and per-use fees. We are also responsible for rotating the keys. Rotating keys involves regularly replacing current encryption keys with new ones to minimize the window of vulnerability and strengthen our data protection measures.
  • AWS Managed Keys (e.g., aliases starting with aws/rds, aws/ebs) are created and managed by AWS in our account with automatic yearly rotation and have no monthly fee; per-use fees may apply. We can view these keys and their usage in CloudTrail.
  • AWS-owned keys are owned and managed by AWS outside our account and will be used across AWS accounts for specific services, such as Amazon S3, for the default encryption. We cannot see these keys in our KMS dashboard, and we cannot see their usage in CloudTrail logs. 

Within the AWS KMS Dashboard, we can select AWS-managed keys or Customer-managed keys. With AWS-managed, we can only see the keys. With customer-managed, we can create keys specifying the Key type - symmetric or asymmetric

Read more about AWS-managed and customer-managed keys at cloudericks.com/blog/understanding-aws-kms-keys-customer-keys-and-aws-keys

Encryption Key Types

AWS KMS Keys can differ based on the encryption and encryption keys used. 

Symmetric vs. Asymmetric Encryption

HMAC KMS keys

Data Keys

  •  Data keys are symmetric keys used for encrypting data, including large data volumes and other encryption keys.
  • Unlike symmetric KMS keys, data keys can be used outside AWS KMS. When AWS KMS generates a data key, it provides a plaintext version for immediate use (optional) and an encrypted copy that can be safely stored alongside the data.
  • Read more at cloudericks.com/blog/understanding-data-keys-in-aws-kms.

Data Key Pairs

  • Data key pairs are asymmetric keys, consisting of related public and private keys, designed for client-side encryption and decryption or signing and verification outside of AWS KMS. 
  • Unlike data key pairs generated by tools like OpenSSL, AWS KMS protects the private key of each data key pair under a symmetric encryption KMS key that you specify.
  • Read more at cloudericks.com/blog/understanding-data-key-pairs-in-aws-kms. 

 AWS KMS User Personas and Roles

The following are two of the most important roles to get started with AWS KMS:

  1. Key Creators are people with permission to create a key. These users are available before creating a key and key policy. While creating the key, they can specify key administrators and key users, which will then be added to the key policy.
  2. Key Administrators manage KMS keys but do not use them in cryptographic operations. They handle tasks such as key configuration and enabling or disabling keys.
  3. Key Users can use the key for cryptographic operations, such as encrypting or decrypting data.

For more information on AWS KMS user persona and roles with role descriptions and use cases, refer to cloudericks.com/blog/understanding-aws-kms-roles-creators-administrators-and-users.

Why Use AWS KMS?

  1. Security: KMS leverages hardware security modules (HSMs) for robust key security, adhering to the FIPS 140-2 Cryptographic Module Validation Program standards. These are trusted by government and financial institutions, ensuring the highest level of security for your cryptographic keys. In the China (Beijing) and China (Ningxia) Regions, where FIPS 140-2 is not supported, AWS KMS uses OSCCA certified HSMs.
  2. ManagementIt simplifies the creation, management, and rotation of encryption keys.
  3. Key policies: Key access is regulated by a key policy, providing precise control over data access, including stipulations on when, how, and by whom the data can be accessed.
  4. Integration: AWS KMS seamlessly integrates with over a hundred AWS services, including major databases, analytics, and storage services. This ensures comprehensive data protection across your entire AWS environment.
  5. Monitoring: Its integration with AWS CloudTrail means all key management actions, lifecycle events, and usage are recorded, helping you manage risks and meet compliance requirements.

Use Cases

  1. Protect Data at Rest: Activate server-side encryption using KMS keys, giving us control and management of our data's security in AWS services.

  2. Encrypt and Decrypt Data: Implement the AWS Encryption SDK for secure cryptographic operations in our applications, enhancing data protection.

  3. Sign and Verify Digital Signatures: Safeguard signing operations with asymmetric KMS keys, ensuring the authenticity and integrity of digital communications.

  4. Build Secure Multi-Tenant Databases: Utilize the AWS Database Encryption SDK to encrypt and securely search sensitive records, providing an added layer of security for database environments.

Best Practices

  1. Key rotation is an essential security practice:
    • AWS KMS can automatically rotate keys every year.
    • You can also manually rotate keys if needed.
  2. Regularly audit your KMS usage with CloudTrail:
    • CloudTrail logs all KMS actions, providing a record of who did what and when.
    • Regularly review these logs for security management.
  3. Regularly review and update key policies.
  4. Use separate keys for different applications or environments.

Getting Started with KMS

  1. Access the AWS KMS service by going to the key management service.
  2. Create a Key - (symmetric is more common)
  3. Configure Key Policies and Permissions to define who can use and manage the key. AWS will create a default policy for Key Administrators and Key users we specify during key creation, and we can customize it as needed later.
  4. Use Our Key to encrypt and decrypt data via the AWS Management Console or programmatically using AWS SDKs. We can also configure other AWS services to use this key for data encryption.

Conclusion

Starting with AWS KMS is a significant step towards securing your cloud data. Remember, the key (pun intended!) is to understand your security needs and configure KMS accordingly. 

See also

Special note on KEWA study group

AWS KMS is a very important service. Please ask our study group if you have any doubts, and the group will try to clear the doubts over a Zoom meeting. If you have purchased any of Heartin's published books, you may ask for a free entry to our study group using this website's contact form. Otherwise, you can share knowledge once a month to get free entry. Read more about KEWA study group at Cloudericks.com/wa

Stay connected with news and updates!

Join our mailing list to receive the latest news and updates from our team.
Don't worry, your information will not be shared.

We hate SPAM. We will never sell your information, for any reason.