Problem:

You are using Amazon EC2 cloud computer and you want to create an
encrypted EBS volume to store sensitive data.For example, you may have a requirement to
protect ‘data at rest’ if you are dealing with personal health information (PHI) in the United States.

These instructions have been tested on Ubuntu 10.10 64-bit Server Edition.

Solution:

1.) Create an EBS disk and attach it to your instance in the AWS management console.

2.) Attach the device to an open /dev device.  In this example we will use ‘/dev/sdc’.

3.) On your EC2 instance perform the following steps.

    sudo apt-get install -y cryptsetup
    sudo modprobe sha256
    sudo modprobe dm_crypt
    sudo modprobe dm_mod
    sudo modprobe aes
    sudo cryptsetup luksFormat -c aes -h sha256 /dev/sdc
    #type YES and return enter a strong passphrase
    sudo cryptsetup luksOpen /dev/sdc encrypted_disk
    #re-enter your passphrase
    sudo mkfs.ext4 /dev/mapper/encrypted_disk
    sudo mkdir /myencryptdisk
    sudo mount -t ext4 /dev/mapper/encrypted_disk /myencryptdisk

And that’s it!  Remember you will need to re-enter the passphrase when remounting the EBS volume.  Good luck!

-Alan @aviars