title: CloudFormation copy AMI to region on demand
body: <p>I am looking to use CloudFormation templates alongside AMI's for which I installed and configured my software to simplify deployment of software setups to a handful of regions and maybe other AWS accounts.</p>
  
  <p>One issue is that the AMI for creating EC2 instances must be in the region, and also the ID gets changed when copying it. Since this is only for a small number of deployments, and most of the images are not needed after the instance is created, I would like to avoid having to copy (and pay for) every image to every region just in case.</p>
  
  <p>Instead is there some way to have my template copy the AMI (e.g. <code>copy-image</code> CLI ) and then use that with the Instance? Ideally it would also delete the AMI afterwards (e.g. <code>deregister-image</code> and <code>delete-snapshot</code>) where being used for persistent EC2 instances or on stack deletion/rollback.</p>