How to do it...

We can encrypt an EBS storage volume while creating an EC2 instance as follows:

  1. Go to the EC2 dashboard and click on Instances from the left sidebar. Click on the Launch Instance button at the top of the page, select Amazon Linux 2 AMI, set Type to t2.micro, and click Next: Configure Instance Details.
  2. Leave the default values as they are in the Configure Instance Details page and click Next: Add Storage.

Now, we should see the Add Storage page with the Root volume:

  1. Click on the drop-down menu for Encryption and select our customer master key (CMK). I will select the default AWS-managed KMS key for EBS:

Optionally, we can ...

Get AWS Security Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.