Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. # Boto 3
  3.  
  4. import boto3
  5. ec2 = boto3.resource('ec2')
  6. snapshot = ec2.Snapshot('id')
  7.  
  8. for vol in ec2.volumes.all():
  9. if vol.state=='in-use':
  10. string=vol.id
  11. ec2.create_snapshot(VolumeId=vol.id,Description=string)
  12. print(vol.id),
  13. print('A snapshot has been created for the following EBS volumes')
  14. else:
  15. print(vol.id),
  16. print('No snapshot has been created for the following EBS volumes')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement