title: What to bake into an AWS AMI and what to provision using cloud-init?
body: <p>I'm using AWS Cloudformation to setup numerous elements of network infrastructure (VPCs, SecurityGroups, Subnets, Autoscaling groups, etc) for my web application. I want the whole process to be automated. I want click a button and be able to fire up the whole thing.</p>
  
  <p>I have successfully created a Cloudformation template that sets up all this network infrastructure. However the EC2 instances are currently launched without any needed software on them. Now I'm trying to figure out how best to get that software on them.</p>
  
  <p>To do this, I'm creating AMIs using <a href="https://packer.io/" rel="noreferrer"><strong>Packer.io</strong></a>. But some people have instead urged me to use Cloud-Init. What heuristic should I use to decide what to bake into the AMIs and/or what to configure via Cloud-Init?</p>
  
  <p>For example, I want to preconfigure an EC2 instance to allow me (<code>saqib</code>) to login without a password from my own laptop. Thus the EC2 must have a user. That user must have a home directory. And in that home directory must live a file <code>.ssh/known_hosts</code> containing encrypted codes. Should I bake these directories into the AMI? Or should I use cloud-init to set them up? And how should I decide in this and other similar cases?</p>