def are_snapshots_tagged(region, snapshot_ids):
"""Check the current snapshot tags to prevent multiple snapshots."""
session = boto3.session.Session(region_name=region)
ec2 = session.resource('ec2')
for sid in snapshot_ids:
snapshot = ec2.Snapshot(sid)
current_tags = snapshot.tags
if not current_tags:
continue
for tag in current_tags:
if tag.get("Key") == VALIDATION_TAG_KEY:
return True
return False
评论列表
文章目录