Skip to content

Instantly share code, notes, and snippets.

@ashutoshkarna03
Created January 12, 2020 19:06
Show Gist options
  • Save ashutoshkarna03/ff5bfbff3a21415e027bf2dc3be9ccca to your computer and use it in GitHub Desktop.
Save ashutoshkarna03/ff5bfbff3a21415e027bf2dc3be9ccca to your computer and use it in GitHub Desktop.
# proceed for deletion
for each_volume_id in volumes_to_delete:
try:
print("Deleting Volume with volume_id: " + each_volume_id)
response = client.delete_volume(
VolumeId=each_volume_id
)
except Exception as e:
print("Issue in deleting volume with id: " + each_volume_id + "and error is: " + str(e))
# waiters to verify deletion and keep alive deletion process until completed
waiter = client.get_waiter('volume_deleted')
try:
waiter.wait(
VolumeIds=volumes_to_delete,
)
print("Successfully deleted all volumes")
except Exception as e:
print("Error in process with error being: " + str(e))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment