Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- # Boto 3
- import boto3
- ec2 = boto3.resource('ec2')
- snapshot = ec2.Snapshot('id')
- for vol in ec2.volumes.all():
- if vol.state=='in-use':
- string=vol.id
- ec2.create_snapshot(VolumeId=vol.id,Description=string)
- print(vol.id),
- print('A snapshot has been created for the following EBS volumes')
- else:
- print(vol.id),
- print('No snapshot has been created for the following EBS volumes')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement