stiang/ec2-purge-snapshots — pull request #3 by xombiemp (2013-06-08 13:55:49+00:00)
Title: Month fix

This fixes the problem that existed, in that it would keep an infinite
number of monthly snapshots. There was no check to even honor the
number of months argument.

This creates a new variable called DELETE_BEFORE_DATE, which is the
current time minus the hours, days and weeks periods combined, and
then the << operator is used on a Date object to go back a certain
number of months. Then a check is added, such that any snapshot that
is older than this computed date is deleted. In this way it actually
honors the months argument and keeps the right amount of snapshots.