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.
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:
- A volume is defined as ‘encrypted’ in EBS
- EBS calls KMS to request a Data Encryption Key
- KMS generates a DEK from the specified Customer Master Key
- The CMK encrypts the DEK
- The DEK is then stored on the encrypted EBS volume as metadata
- The EBS volume is then attached to an EC2 instance
- EC2 sends a ‘decrypt’ request to KMS with the encrypted DEK from the volume
- KMS decrypts the DEK into a plaintext DEK and sends it back to the EC2 instance
- EC2 stores the plaintext DEK in its hypervisor memory for as long as the EBS volume is attached to the instance
- EC2 uses the DEK to perform I/O encryption to the volume using the AES-256 algorithm
How to encrypt a new EBS volume
- From within the AWS Management Console, select EC2
- Under ‘Elastic Block Store’ select ‘Volumes’
- Select ‘Create Volume’
- Enter the required configuration for your Volume
- Select the checkbox for ‘Encrypt this volume’
- Select the KMS Customer Master Key (CMK) to be used under ‘Master Key’
- Select ‘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
- From within the AWS Management Console, select EC2
- Select ‘Launch Instance’
- Select your AMI type
- Select your Instance Type
- Click ‘Next: Configure Instance Details’
- Configure your instance as required
- Select ‘Next: Add Storage’
- Select ‘Add New Volume’
- Ensure your volume type is ‘EBS’ and configure your storage requirements
- Select the drop-down list under ‘Encryption’ and select the KMS CMK key to be used
- Continue with your EC2 instance launch process
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’
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
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:
- Go to the EC2 Console Dashboard > Settings (under account attributes)
- Select ‘Always encrypt new EBS volumes’
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 types that support AWS EBS encryption
A1 | M3 | M4 | M5 | M5a | M5ad | M5d | M5dn | M5n | T2 | T3 | T3a
C3 | C4 | C5 | C5d | C5n
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
D2 | h1.2xlarge | h1.4xlarge | I2 | I3 | I3en
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:
New Content: AWS Terraform, Java Programming Lab Challenges, Azure DP-900 & DP-300 Certification Exam Prep, Plus Plenty More Amazon, Google, Microsoft, and Big Data Courses
This month our Content Team continues building the catalog of courses for everyone learning about AWS, GCP, and Microsoft Azure. In addition, this month’s updates include several Java programming lab challenges and a couple of courses on big data. In total, we released five new learning...
Where Should You Be Focusing Your AWS Security Efforts?
Another day, another re:Invent session! This time I listened to Stephen Schmidt’s session, “AWS Security: Where we've been, where we're going.” Amongst covering the highlights of AWS security during 2020, a number of newly added AWS features/services were discussed, including: AWS Audit...
AWS re:Invent: 2020 Keynote Top Highlights and More
We’ve gotten through the first five days of the special all-virtual 2020 edition of AWS re:Invent. It’s always a really exciting time for practitioners in the field to see what features and services AWS has cooked up for the year ahead. This year’s conference is a marathon and not a...
WARNING: Great Cloud Content Ahead
At Cloud Academy, content is at the heart of what we do. We work with the world’s leading cloud and operations teams to develop video courses and learning paths that accelerate teams and drive digital transformation. First and foremost, we listen to our customers’ needs and we stay ahea...
Excelling in AWS, Azure, and Beyond – How Danut Prisacaru Prepares for the Future
Meet Danut Prisacaru. Danut has been a Software Architect for the past 10 years and has been involved in Software Engineering for 30 years. He’s passionate about software and learning, and jokes that coding is basically the only thing he can do well (!). We think his enthusiasm shines t...
New Content: AWS Data Analytics – Specialty Certification, Azure AI-900 Certification, Plus New Learning Paths, Courses, Labs, and More
This month our Content Team released two big certification Learning Paths: the AWS Certified Data Analytics - Speciality, and the Azure AI Fundamentals AI-900. In total, we released four new Learning Paths, 16 courses, 24 assessments, and 11 labs. New content on Cloud Academy At any ...
New Content: Azure DP-100 Certification, Alibaba Cloud Certified Associate Prep, 13 Security Labs, and Much More
This past month our Content Team served up a heaping spoonful of new and updated content. Not only did our experts release the brand new Azure DP-100 Certification Learning Path, but they also created 18 new hands-on labs — and so much more! New content on Cloud Academy At any time, y...
AWS Certification Practice Exam: What to Expect from Test Questions
If you’re building applications on the AWS cloud or looking to get started in cloud computing, certification is a way to build deep knowledge in key services unique to the AWS platform. AWS currently offers 12 certifications that cover major cloud roles including Solutions Architect, De...
Overcoming Unprecedented Business Challenges with AWS
From auto-scaling applications with high availability to video conferencing that’s used by everyone, every day — cloud technology has never been more popular or in-demand. But what does this mean for experienced cloud professionals and the challenges they face as they carve out a new p...
Constant Content: Cloud Academy’s Q3 2020 Roadmap
Hello — Andy Larkin here, VP of Content at Cloud Academy. I am pleased to release our roadmap for the next three months of 2020 — August through October. Let me walk you through the content we have planned for you and how this content can help you gain skills, get certified, and...
New Content: Alibaba, Azure AZ-303 and AZ-304, Site Reliability Engineering (SRE) Foundation, Python 3 Programming, 16 Hands-on Labs, and Much More
This month our Content Team did an amazing job at publishing and updating a ton of new content. Not only did our experts release the brand new AZ-303 and AZ-304 Certification Learning Paths, but they also created 16 new hands-on labs — and so much more! New content on Cloud Academy At...
Blog Digest: Which Certifications Should I Get?, The 12 Microsoft Azure Certifications, 6 Ways to Prevent a Data Breach, and More
This month, we were excited to announce that Cloud Academy was recognized in the G2 Summer 2020 reports! These reports highlight the top-rated solutions in the industry, as chosen by the source that matters most: customers. We're grateful to have been nominated as a High Performer in se...