How to Encrypt an EBS Volume

Keeping data and applications safe in the cloud is one of the most visible challenges facing cloud teams in 2020. Cloud storage services where data resides are frequently a target for hackers, not because the services are inherently weak but because they are often improperly configured.

Why encrypt an EBS volume?

Encryption—to protect data at rest and in-flight—should be an organization’s number-one priority when using any storage service. On AWS, its Elastic Block Store (EBS) service provides persistent block-level storage volumes for Amazon EC2 instances. EBS volumes can be attached to your instances and primarily used for data that is rapidly changing or that requires specific input/output operations per second, (IOPS). Because they provide persistent level storage to your instances, EBS volumes are ideally suited for retaining important data and can be used to store personally identifiable information (PII). In any environment where this is the case, it’s essential that data on the volume is encrypted to protect it from malicious activity.

AWS makes encryption easy. In this article, we’ll step through three processes using AWS Elastic Block Store to help you make sure that your encryption is configured correctly. When you’re ready to get some hands-on experience creating an EC2 instance with additional EBS volume in a real AWS environment, check out Managing Instance Volumes Using EBS. During this hands-on lab, you will learn to attach and detach an EBS to/from a specific EC2 instance, take a snapshot, and master how to delete a volume.

Managing Instance Volumes Using EBS Hands-on Lab

Methods to encrypt an EBS volume

With the EBS encryption mechanism, you don’t have to worry about managing keys to perform encryption yourself—it’s all managed and implemented by EBS. However, there are a couple of different ways that encryption can be applied depending on how and when you are creating your new EBS volumes. I will walk you through each process.

How EBS works with Key Management Service (KMS)

How does AWS set up EBS encryption?

Let’s start with the behind-the-scenes basics. The EBS service interacts with another AWS service, the Key Management Service (KMS) to perform encryption. KMS uses Customer Master Keys (CMK) to create Data Encryption Keys (DEK), which enables data encryption across EBS and a range of AWS services.

When a volume is defined as an encrypted volume, EBS sends a request to KMS asking for a Data Encryption Key. The DEK is generated AND encrypted by the Customer Master Key, which by default will be a unique, regional CMK provided by AWS unless otherwise specified. The encrypted DEK is then stored with the metadata on the EBS volume.

It’s important to point out that no data has been encrypted up to this point. So far only the Data Encryption Key has been encrypted. The data encryption process is driven from the EC2 instance, not the EBS volume, so your data will be encrypted when it is connected to an associated EC2 instance.

When the volume is attached to an EC2 instance, the instance sends a ‘decrypt’ request to KMS along with the encrypted DEK from the EBS volume. KMS then responds with a plaintext version of the DEK. EC2 will store this within its hypervisor memory, allowing the instance itself to perform encryption on any read/writes to the EBS volume using the plaintext version of the DEK.

The DEK uses the AES-256 (Advanced Encryption Standard – 256 bit) algorithm to encrypt any data written. The process is managed from the EC2 instance, which ensures that the data is also encrypted when in transit to the EBS volume.

The inter-service process involved encrypting an EBS volume

Let’s look at the full process:

  1. A volume is defined as ‘encrypted’ in EBS
  2. EBS calls KMS to request a Data Encryption Key
  3. KMS generates a DEK from the specified Customer Master Key
  4. The CMK encrypts the DEK
  5. The DEK is then stored on the encrypted EBS volume as metadata
  6. The EBS volume is then attached to an EC2 instance
  7. EC2 sends a ‘decrypt’ request to KMS with the encrypted DEK from the volume
  8. KMS decrypts the DEK into a plaintext DEK and sends it back to the EC2 instance
  9. EC2 stores the plaintext DEK in its hypervisor memory for as long as the EBS volume is attached to the instance
  10. EC2 uses the DEK to perform I/O encryption to the volume using the AES-256 algorithm

How to encrypt a new EBS volume

  1. From within the AWS Management Console, select EC2
  2. Under ‘Elastic Block Store’ select ‘Volumes’
  3. Select ‘Create Volume’
  4. Enter the required configuration for your Volume
  5. Select the checkbox for ‘Encrypt this volume’
  6. Select the KMS Customer Master Key (CMK) to be used under ‘Master Key’
  7. Select ‘Create Volume’

Encryption EBS Create Volume
Once your volume has been created, all data saved to this volume will be encrypted when attached to an EC2 instance.

How to encrypt a new EBS volume when launching an EC2 instance

  1. From within the AWS Management Console, select EC2
  2. Select ‘Launch Instance’
  3. Select your AMI type
  4. Select your Instance Type
  5. Click ‘Next: Configure Instance Details’
  6. Configure your instance as required
  7. Select ‘Next: Add Storage’
  8. Select ‘Add New Volume’
  9. Ensure your volume type is ‘EBS’ and configure your storage requirements
  10. Select the drop-down list under ‘Encryption’ and select the KMS CMK key to be used
  11. Continue with your EC2 instance launch process

Volume Type Encryption
The EBS volume attached to that instance will now be encrypted. It’s also worth noting that any snapshots created from these encrypted volumes (and any volumes created from these snapshots) will also be encrypted.

How to encrypt an existing EBS volume

An existing unencrypted volume and the data it contains may not be encrypted. Instead, you’ll need to follow another process, outlined below.
1. Select your unencrypted volume
2. Select ‘Actions’ – ‘Create Snapshot’
3. When the snapshot is complete, select ‘Snapshots’ under ‘Elastic Block Store’ Select your newly created snapshot
4. Select ‘Actions’ – ‘Copy’
5. Check the box for ‘Encryption’
6. Select the CMK for KMS to use as required
7. Click ‘Copy’
Snapshot Encryption Master Key
8. Select the newly created snapshot
9. Select ‘Actions’ – ‘Create Volume’
10. You will notice that the normal ‘Encryption’ option is set to ‘True.’ Because the snapshot is itself encrypted, this cannot be modified. The volume now created from this snapshot will be encrypted
Encryption EBS Create Volume True

How to opt-in to default encryption for new EBS volumes

AWS has also introduced a feature that works to allow users (and of particular value to admins) to automatically enable encryption on all EBS volumes created within a specific region. Note: this is wide-reaching, but it only works on a per-region basis, so the decision to opt-in to default encryption will need to be enabled in all regions individually.

The advantages of this feature are:

  • Ensures that all newly-created volumes are encrypted
  • Helps avoid launch failures based on IAM-policies that require encrypted EBS volumes
  • Costs nothing extra
  • Is accessible through the AWS Console, as well as EC2 CLI and API
  • Provides an easy step towards meeting compliance goals

The steps to opt-into default encryption are:

  1. Go to the EC2 Console Dashboard > Settings (under account attributes)
  2. Select ‘Always encrypt new EBS volumes’
EBS opt-in to encryption

Supported Instance Types for Encryption

Although all EBS volume types support encryption, not all instance types are supported.

The following AWS instance types are supported for EBS encryption:

Instance Family

Instance types that support AWS EBS encryption

General purpose

A1 | M3 | M4 | M5 | M5a | M5ad | M5d | M5dn | M5n | T2 | T3 | T3a

Compute optimized

C3 | C4 | C5 | C5d | C5n

Memory optimized

cr1.8xlarge | R3 | R4 | R5 | R5a | R5ad | R5d | R5dn | R5n | u-6tb1.metal | u-9tb1.metal | u-12tb1.metal | u-18tb1.metal | u-24tb1.metal | X1 | X1e | z1d

Storage optimized

D2 | h1.2xlarge | h1.4xlarge | I2 | I3 | I3en

Accelerated computing

F1 | G2 | G3 | G4 | Inf1 | P2 | P3

        Data Source: Encryption Supported Instances

Be sure to consult the official AWS documentation to stay up to date with the supported instance types.

Your next steps with encryption best practices

Now that you understand how your sensitive data can be protected through EBS encryption, you’ll want to learn more about encryption for other AWS services such as Encryption in S3, KMS, Redshift, and CloudHSM.

You can get started with these courses from the Cloud Academy Training Library:

Avatar

Written by

Stuart Scott

Stuart is the AWS content lead at Cloud Academy where he has created over 40 courses reaching tens of thousands of students. His content focuses heavily on cloud security and compliance, specifically on how to implement and configure AWS services to protect, monitor and secure customer data and their AWS environment.


Related Posts

Alisha Reyes
Alisha Reyes
— February 7, 2020

New on Cloud Academy: Git Labs, CKA and CKAD Lab Challenges, AWS and Azure Learning Paths, AGILE, and Much More

We just kicked off our first Free Weekend of 2020. This means we've unlocked our Training Library for just 72 hours. Until Sunday at 11:59 pm (PST), you can get unlimited access to our industry-leading learning paths, courses, certification prep exams, and our most popular hands-on labs...

Read more
  • agile
  • AWS
  • Azure
  • Google Cloud Platform
  • Linux
  • OWASP
  • programming
  • red hat
  • scrum
Vitaly Kuprenko
Vitaly Kuprenko
— February 4, 2020

Heroku vs. AWS: Which Cloud Solution Works Best in 2020

Heroku vs. AWS: Introduction Сloud-based platforms get more and more recognition. According to Statista, just in the third quarter of 2019, cloud market revenues reached $27.5 billion. By moving to the cloud, businesses can focus on their strategy and other processes instead of dealing...

Read more
  • AWS
  • heroku
Alisha Reyes
Alisha Reyes
— January 31, 2020

How to Unlock Complimentary Access to Cloud Academy

Are you looking to get trained or certified on AWS, Azure, Google Cloud Platform, DevOps, Cybersecurity, Information Security, Python, Java, or another technical skill? Then you'll want to mark your calendars. Starting Friday, February 7 at 12:00 a.m. PST (3:00 a.m. EST), Cloud Acade...

Read more
  • AWS
  • Azure
  • cloud academy content
  • complimentary access
  • GCP
  • on the house
Alisha Reyes
Alisha Reyes
— January 28, 2020

Cloud Academy’s Blog Digest: Top 5 AWS Salary Report Findings, How To Become a Cybersecurity Professional, 8 Financial Benefits of Cloud Migration, and more

Now that it's 2020, how many times have you caught yourself dating a paper 2019? Don't lie. It's happened at least once or twice — or a handful of times — I'm sure. And if you're a member of the "perfect club" that hasn't made any 2020 mistakes, then we're still happy to have you in our...

Read more
  • AWS
  • aws salary
  • blog digest
  • Cloud Academy
  • Cloud Adoption
  • Cloud Migration
  • Cybersecurity
Patrick Navarro
Patrick Navarro
— January 22, 2020

Top 5 AWS Salary Report Findings

At the speed the cloud tech space is developing, it can be hard to keep track of everything that’s happening within the AWS ecosystem. Advances in technology prompt smarter functionality and innovative new products, which in turn give rise to new job roles that have a ripple effect on t...

Read more
  • AWS
  • salary
Alisha Reyes
Alisha Reyes
— January 6, 2020

New on Cloud Academy: Red Hat, Agile, OWASP Labs, Amazon SageMaker Lab, Linux Command Line Lab, SQL, Git Labs, Scrum Master, Azure Architects Lab, and Much More

Happy New Year! We hope you're ready to kick your training in overdrive in 2020 because we have a ton of new content for you. Not only do we have a bunch of new courses, hands-on labs, and lab challenges on AWS, Azure, and Google Cloud, but we also have three new courses on Red Hat, th...

Read more
  • agile
  • AWS
  • Azure
  • Google Cloud Platform
  • Linux
  • OWASP
  • programming
  • red hat
  • scrum
Alisha Reyes
Alisha Reyes
— December 24, 2019

Cloud Academy’s Blog Digest: Azure Best Practices, 6 Reasons You Should Get AWS Certified, Google Cloud Certification Prep, and more

Happy Holidays from Cloud Academy We hope you have a wonderful holiday season filled with family, friends, and plenty of food. Here at Cloud Academy, we are thankful for our amazing customer like you.  Since this time of year can be stressful, we’re sharing a few of our latest article...

Read more
  • AWS
  • azure best practices
  • blog digest
  • Cloud Academy
  • Google Cloud
Avatar
Guy Hummel
— December 12, 2019

Google Cloud Platform Certification: Preparation and Prerequisites

Google Cloud Platform (GCP) has evolved from being a niche player to a serious competitor to Amazon Web Services and Microsoft Azure. In 2019, research firm Gartner placed Google in the Leaders quadrant in its Magic Quadrant for Cloud Infrastructure as a Service for the second consecuti...

Read more
  • AWS
  • Azure
  • Google Cloud Platform
Alisha Reyes
Alisha Reyes
— December 10, 2019

New Lab Challenges: Push Your Skills to the Next Level

Build hands-on experience using real accounts on AWS, Azure, Google Cloud Platform, and more Meaningful cloud skills require more than book knowledge. Hands-on experience is required to translate knowledge into real-world results. We see this time and time again in studies about how pe...

Read more
  • AWS
  • Azure
  • Google Cloud
  • hands-on
  • labs
Alisha Reyes
Alisha Reyes
— December 5, 2019

New on Cloud Academy: AWS Solution Architect Lab Challenge, Azure Hands-on Labs, Foundation Certificate in Cyber Security, and Much More

Now that Thanksgiving is over and the craziness of Black Friday has died down, it's now time for the busiest season of the year. Whether you're a last-minute shopper or you already have your shopping done, the holidays bring so much more excitement than any other time of year. Since our...

Read more
  • AWS
  • AWS solution architect
  • AZ-203
  • Azure
  • cyber security
  • FCCS
  • Foundation Certificate in Cyber Security
  • Google Cloud Platform
  • Kubernetes
Avatar
Cloud Academy Team
— December 4, 2019

Understanding Enterprise Cloud Migration

What is enterprise cloud migration? Cloud migration is about moving your data, applications, and even infrastructure from your on-premises computers or infrastructure to a virtual pool of on-demand, shared resources that offer compute, storage, and network services at scale. Why d...

Read more
  • AWS
  • Azure
  • Data Migration
Wendy Dessler
Wendy Dessler
— November 27, 2019

6 Reasons Why You Should Get an AWS Certification This Year

In the past decade, the rise of cloud computing has been undeniable. Businesses of all sizes are moving their infrastructure and applications to the cloud. This is partly because the cloud allows businesses and their employees to access important information from just about anywhere. ...

Read more
  • AWS
  • Certifications
  • certified