Skip to main content

Command Palette

Search for a command to run...

Day 41: Securing Data with AWS KMS

100 Days of Cloud (AWS)

Updated
2 min read
Day 41: Securing Data with AWS KMS
Z

I'm Zin Lin Htet. Who love to learn and share about Linux, Cloud, Docker and K8s. Currently working as a DevOps Engineer at one of the famous Fintech Company in Myanmar.

Welcome to Day 41. Today we will learn how to securing data with AWS KMS.

What is AWS KMS?

AWS Key Management Service (KMS) is a managed service that makes it easy for you to create and control the cryptographic keys used to protect your data. It provides a highly available, secure, and centralized hub for managing encryption across your entire AWS environment.

Core Functions of AWS KMS

AWS KMS handles the "heavy lifting" of cryptography so you don't have to manage complex hardware or software.

  • Key Lifecycle Management: You can create, rotate, disable, and delete keys.

  • Centralized Control: Manage permissions for who can use or manage keys through IAM (Identity and Access Management) and Key Policies.

  • Auditability: Every time a key is used, it is logged in AWS CloudTrail, allowing you to see exactly who used a key, when, and for what resource.

  • High Security: Keys are protected by FIPS 140-2 validated Hardware Security Modules (HSMs). Plaintext master keys never leave these modules.

#Create the Key
aws kms create-key --description "Nautilus datacenter-KMS-Key"

#Create the alias
aws kms create-alias --alias-name alias/datacenter-KMS-Key --target-key-id <your-key-id>

#Encrypt and encode the file
aws kms encrypt \
    --key-id alias/datacenter-KMS-Key \
    --plaintext fileb:///root/SensitiveData.txt \
    --query CiphertextBlob \
    --output text | base64 --decode > /root/EncryptedData.bin

#Decrypt the file
aws kms decrypt \
    --ciphertext-blob fileb:///root/EncryptedData.bin \
    --query Plaintext \
    --output text | base64 --decode > /root/DecryptedData.txt

#Compare Results
diff /root/SensitiveData.txt /root/DecryptedData.txt

Congratulations you did it. It looks good. This lab was successfully completed without any errors. See you in day 42. If you have any issues please let me know I will be happy to assist you. Stay tuned and learn together. If you find my article useful, please kindly like and share it.

100 Days of Cloud (AWS)

Part 10 of 50

In this series you will learn how to configure and manage cloud resources using AWS. My intention is to provide an explanation and share the answers for 100 Days of Cloud (AWS) from KodeKloud.

Up next

Day 40: Troubleshooting Internet Accessibility for an EC2-Hosted Application

100 Days of Cloud (AWS)

More from this blog

Technical 101

69 posts

"Mingalarbar , I am an IT guy from Myanmar who enjoys learning and sharing about Linux, Cloud, Docker & K8s. I am planning to share my expertise with the information technology communities in Burma