title: How to define an ECR Lifecycle Policy with CloudFormation
body: <p>In order to limit the number of images in a repository, I'd like to define a Lifecycle policy. Since all the stack is defined with CloudFormation, I'd like to define this policy too.</p>
  
  <p>For example, my policy could be "keep only the most recent 8 images, no matter if tagged or not". </p>