From a8fa4141c59d0b394643dcd9a7923faa22e6645b Mon Sep 17 00:00:00 2001 From: Jesse Adelman Date: Wed, 29 Nov 2017 18:45:17 -0500 Subject: [PATCH] Add ':' to Snapshot Description. --- schedule-ebs-snapshot-backups.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/schedule-ebs-snapshot-backups.py b/schedule-ebs-snapshot-backups.py index ab201f0..c2d7f9d 100644 --- a/schedule-ebs-snapshot-backups.py +++ b/schedule-ebs-snapshot-backups.py @@ -44,6 +44,9 @@ def lambda_handler(event, context): except IndexError: retention_days = 7 + # See https://github.com/boto/boto3/issues/264#issuecomment-213573980 + tags = dict(map(lambda x: (x['Key'], x['Value']), instance['Tags'] or [])) + for dev in instance['BlockDeviceMappings']: if dev.get('Ebs', None) is None: continue @@ -53,6 +56,7 @@ def lambda_handler(event, context): snap = ec.create_snapshot( VolumeId=vol_id, + Description="%s:%s" % (tags['Name'], dev['DeviceName']) ) to_tag[retention_days].append(snap['SnapshotId'])