hands-on lab

Using Amazon Key Management Service to Encrypt S3 and EBS Data

Difficulty: Intermediate
Duration: Up to 2 hours
Students: 10,277
Rating: 4.5/5
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.

Description

Amazon Web Services Key Management Service (KMS) is a managed service that simplifies the creation and management of encryption keys used to encrypt/decrypt your data. Most storage-related AWS services are supported by KMS, including:

  • EBS (Elastic Block Store)
  • S3 (Simple Storage Service)
  • Redshift
  • RDS (Relational Database Service)

This lab will include examples of encrypting EBS volumes and S3 buckets. It's important to understand that once setup is implemented, from a user's perspective, the encryption of data is transparent. For example, if you look at a text file on an encrypted volume, it is readable. That is because the encryption is not on a file-by-file basis, with some being encrypted and some not. Encryption takes place at a lower level (the operating system level). If you view a text file, the decrypted file is displayed. Similarly, for S3 object storage, you can still view text files, images, etc. What volume encryption protects against is if someone gains physical access to the drive with the encrypted data on it. If they don't have the Customer Master Key (CMK), they cannot decrypt the contents.

Although not the focus of this lab, realize that just because KMS is integrated with many AWS services, KMS can be utilized without other AWS services. What good does that do you might ask? Consider the following use case: an internally developed banking application that uses no AWS services or infrastructure. Even though the application uses infrastructure in their own data centers, and encryption keys with key material they generated themselves, there may be many keys to manage. You can generate your own key material and KMS can store and manage all of it, including helpful maintenance functions such as key rotation and scheduled key deletions. Even if someone gains physical access to disk arrays in their data center, they will not be able to gain access to the data. They would need the encrypted keys uploaded to and managed by AWS KMS.

Learning Objectives

Upon completion of this lab you will be able to:

  • Explain key terms surrounding AWS KMS
  • Create a new Customer Master Key (CMK) using AWS KMS 
  • Use the CMK to encrypt an EBS volume and attach that to a running EC2 instance for use
  • Turn on CloudTrail for auditing purposes and deliver its logs to an encrypted S3 bucket
  • Disable and enable CMKs
  • Confirm that encryption is turned on and working

Intended Audience

  • Candidates for AWS certification
  • Cloud Architects
  • Data Engineers
  • DevOps Engineers
  • Software Engineers

Prerequisites

This is an intermediate-level lab. Although it walks you through all steps in the learning process, you should be familiar with the following:

  • Basic understanding of security concepts such as encryption/decryption and security keys
  • EC2 instances
  • EBS volumes
  • S3 buckets
  • IAM (Identity Access Management) Roles, Policies, and permissions

The following courses can be used to fulfill the prerequisites:

Environment

Before completing the lab instructions the environment will look as follows:

  • A temporary role will be created for you so you can read from/write to an S3 bucket from a running EC2 instance

After completing the lab instructions the environment should look similar to:

 

Updates

September 18th, 2023 - Added warning message regarding EC2 configuration to improve clarity

October 30th, 2022 - Updated instructions and screenshots to match the new EC2 instance creation wizard etc.

February 2nd, 2022 - Removed the step about using your own key material after refactoring it into another lab

June 4th, 2021 - Updated the instructions to get to the full CloudTrail creation workflow

May 14th, 2020 - Updated the instructions/screenshots for the CloudTrail creation

February 3rd, 2020 - Added custom validation steps to check the work you perform in the lab

January 6th, 2020 - Updated content for creating a Customer Master Key to reflect the latest KMS console experience 

August 12th, 2019 - Updated a lab step to reflect new AWS Management Console structure

January 10th, 2019 - Added a validation lab step to check the work you perform in the .ab

Covered topics

Lab steps

Logging In to the Amazon Web Services Console
Learning important Key Management Service (KMS) terms
Turning on CloudTrail and logging to S3 with Encryption
Creating a Customer Master Key (CMK)
Launching a basic EC2 Instance
Creating an Encrypted EBS Volume
Disabling the Customer Master Key