Installing ZFS in an AWS EC2 Instance Using User-Data

Quick post on installing ZFS into an AWS instance using user-data and cloud-init.

I’m doing some work with Kubernetes, which uses Docker, and Docker can use ZFS as a backing store. I want ZFS configured before I do anything else, and the best way to do that is to either create a specific Amazon machine image (AMI) or to use user-data. I chose the former.

Note that this is an instance-store AMI and has two block devices, xvdb and xvdc.