AWS KMS encryption keys
AWS KMS supports different types of encryption keys, including customer master keys (CMKs)https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html, symmetric keys, and asymmetric keys. Symmetric keys are typically used for encrypting and decrypting data with the same key, while asymmetric keys use separate public and private keys for encryption and decryption. AWS KMS also offers key management functionality, allowing you to control permissions and auditing of key usage.
Why encrypt data outside of AWS?
Encrypting data outside of AWS is necessary in various scenarios, such as in hybrid environments or when sensitive data is shared across different systems. AWS KMS can be used to encrypt data outside AWS to extend security capabilities across different infrastructures, including on-premises servers or non-AWS cloud services. This is known as off-cloud encryption, ensuring that data remains secure even if it's stored or transmitted outside AWS.
To use the encryption service, we have to start by generating a customer-managed key. One thing to remember is that KMS is not an encryption service. It is a key management service that can be used to securely and easily manage the keys used for encryption.
How does KMS work?
Here’s a brief demonstration of how KMS is used:
Step 1: Generate a KMS key
A KMS key is a core component of KMS and, as the name suggests, it is the main key used to generate or encrypt/decrypt other keys. There are two types of KMS keys:
AWS-managed
Customer-managed
In this Answer, we’ll use a customer-managed key to encrypt our data because an AWS-managed key can only be used with other AWS services.
To generate a customer-managed key, we use the aws kms create-key
command. Execute this command in the terminal given below: