https://github.com/avsm/mirage/blob/master/scripts/ec2.sh
Unfortunately, I can't figure out the AWS magic to build EBS images directly, which means that you can't use the free m1.micro instances with this script. Help from anyone who knows welcome...