cloud patterns: AMI management

I recently found out that when Packer generates an AMI it also creates EBS snapshots and those snapshots are not cleaned up when the AMI is de-registered. Here’s the script I now use to manage a rolling window of the most recent AMIs