def initialize_snapshot_tags(event, context):
"""
Event comes in with snapshot info, make sure we"re working with a snapshot
we"re supposed to and wait for it to be done snapshotting.
"""
session = boto3.session.Session(region_name=event.get("region"))
ec2 = session.resource("ec2")
snapshot_ids = [vol["snapshot-id"] for vol in event.get("backup-volumes")]
for sid in snapshot_ids:
if ec2.Snapshot(sid).state != "completed":
raise NotReady("Snapshot not ready")
return event
评论列表
文章目录