Ich benutze Boto3 um einen Snapshot einer ID zu erstellen und ich muss nur überprüfen, ob der Snapshot fertig ist, aber die folgende Schleife macht das nicht und läuft nur zu Unendlichkeit.Wie überprüfe ich, ob der Snapshot jetzt 'abgeschlossen' ist?
regions = ['eu-central-1']
for region in regions:
ec2 = boto3.resource('ec2', region, aws_access_key_id=ACCESS_KEY, aws_secret_access_key=SECRET_KEY,)
snapshot = ec2.create_snapshot(VolumeId='vol-f9e7d220', Description='fra01-he-trial-ansible01')
print snapshot.id
get_all_snapshots = ec2.snapshots.filter(snap_id=['SnapshotIds'])
print get_all_snapshots
while snapshot.state != 'completed':
## put a condition here to get all snapshot or update the state !
print snapshot.progress
print "Snapshot under creation"
time.sleep(10)
else:
print "snapshot READY"
dies scheint zu funktionieren! – Kittystone