https://packer.io/ offers a way of scripting up AMI creation. See for example: https://github.com/awslabs/cfncluster-cookbook/blob/develop/build_ami.sh