3 ms·
Ask HN: Do you bake AMIs for AWS deployments?
I am curious how people are doing their staging and production deployments on AWS. Do you bake everything into the AMI and do nothing at boot? Do you boot a vanilla AMI and do all configuration during boot? Something in the middle? If you don't fully bake, is it because it is too hard to manage?
- dkoch 13y agoI create an AMI with a bare minimum OS. Then I use a configuration management tool to install all software packages, libraries and configurations. My new favorite is Ansible (ansibleworks.com) but Chef and Puppet are others. Updates are easier this way versus having to rebake images.
- pas256 13y agoEasier in what sense? Baking, deploying, or managing the AMIs? Also, are you using AutoScaling Groups with this methodology?
- dkoch 13y agoI think more flexible is a better word -- it can do more than what you can do when you bake a static image because you also use it to dynamically manage a running system post-boot. Ansible can deploy all of your dependencies, keep them updated, push out configuration changes, and deploy your main application code. I don't use AutoScaling, but no reason it couldn't be used with Ansible. The docs have a bit of detail on how to do it. http://docs.ansible.com/guide_aws.html http://docs.ansible.com/guide_aws.html
- pas256 13y agoI wrote the EC2 inventory plugin, so yes, I am a big fan of Ansible. I however, now use Ansible almost exclusively to build AMIs. Do your application code deploys require downtime, or do you have a technique to keep the service online while making changes? I highly recommend you start using ASGs. It is only a matter of time before things go bad if you don't.
- benblack 13y agoI make complete AMIs with packer, configure them entirely using environment variables in userdata, configuration data in etcd, and shell scripts, and run all services in docker containers, which I also build using packer. With all services in containers, AMIs are almost never rebuilt and there is no need for configuration management/mutating infrastructure. Building containers with packer is easier than switching to Dockerfiles for existing builds, but does not support fast, incremental build and deploy or tagging. Even without those features, I see no advantages in traditional CM other than the convenience of familiarity and legacy.
- pas256 13y agoCool. This allows you to use ASGs too. I am hearing more people using Docker on AWS, even though the Docker guys don't recommend production use yet. By not supporting fast, incremental build and deploy, just how do you deploy new application code?
- nickstinemates 13y agoUsing Docker in production is about stability of API, not technology. Meaning, for those companies/projects with fast, iterative cycles, who want to take advantage of Docker but understand it's an investment in time over the long run, it's a great fit today. For those companies/projects with slower cycles, who want a solution which will fit their needs out of the box backed by some sort of support.. 1.0 is the target.
- nickstinemates 13y agoInteresting process. We tried to incorporate Packer in to the Docker Release process but found it just took way too long. Best of luck, I hope it works out for you.
- shykes 13y agoWhat does a typical packer config file look like for building a docker container? I think of it as a useless abstraction on top of docker, but that's probably because I only generate containers and don't need the other packer targets. I only ever need one AMI, GCE image or vbox: the boot2docker base. And even that is exported from a container :)
- geetarista 13y agoI use Ansible for all configuration management. Boxes that belong to ASGs use Ansible to create a pre-baked AMI, while the rest are just handled with Ansible on a case-by-case basis.
- pas256 13y agoAre you using the Aminator or Packer Ansible provisioners, or do you have another technique for building those AMIs?
- geetarista 13y agoRight now I'm just using an ansible playbook to provision the box, create the AMI, and destroy the box within a playbook. In the near future I plan on moving to Packer since it's the perfect tool for the job.