Adding automated AMI generation to EC2 with Ruby server start up script

Also, isn't storing API keys in source control like this a terrible practice?