For instance:
count = 0
while True:
try:
if count == 5:
break
snap = ec.create_snapshot(
VolumeId=vol_id,
Description=instance['InstanceId']
)
break
except Exception as e:
print(e)
sleep(180)
count = count + 1
So If I have lot of instances and errors then it could be long time of running lambda. What could be alternative to put Lambda to sleep?