cmachler / aws-lambda-ebs-backups

Python scripts to be run using AWS's Lambda service to Backup and Delete Snapshots of EBS Volumes
MIT License
31 stars 21 forks source link

Sometimes the lambda tries to tag snapshots that have not yet been created. #13

Open legkovalex opened 6 years ago

legkovalex commented 6 years ago

Retaining snapshot snap-071f711539ba0276a of volume vol-a139336bed from instance i-9117b492be for 7 days Will delete 9 snapshots on 2017-12-14 An error occurred (InvalidSnapshot.NotFound) when calling the CreateTags operation: The snapshot 'snap-071f711539ba0276a' does not exist.: ClientError Traceback (most recent call last):

Sometimes snapshots do not have time to be created before they start tagging. It seems that a small timeout between the creation of snapshots and their tagging will not be superfluous.

cmachler commented 6 years ago

Just curious how many snapshots are trying to be created in your environment?

legkovalex commented 6 years ago

Approximately ten snapshots in three regions. The error is not constant and occurs once for a dozen times, approximately. The most unpleasant thing is that we must clear snapshots manually since they are not tagged for deletion (within the region). I think that the possibility of setting the timeout would be appropriate. Probably, as a variable (such as regions) with a default value of 0 seconds (if empty). With the possibility of increasing if necessary.

cmachler commented 6 years ago

I think that sounds reasonable with regards to the timeout variable @legkovalex.

Would you have time to work on this feature and put in a PR? I do not have the time currently to work on this in a expedited manor.