/usr/lib/python2.6/site-packages/boto/pyami/installers/ubuntu
Edit: /usr/lib/python2.6/site-packages/boto/pyami/installers/ubuntu/ebs.pyo (8559B)
Ñò
Å-õSc
@ s– d Z d d k Z d d k l Z d d k l Z d d k Z d d k Z d d k l Z d d k
l Z d Z d Z
d Z d
e f d „ ƒ YZ d S( s
Automated installer to attach, format and mount an EBS volume.
This installer assumes that you want the volume formatted as
an XFS file system. To drive this installer, you need the
following section in the boto config passed to the new instance.
You also need to install dateutil by listing python-dateutil
in the list of packages to be installed in the Pyami seciont
of your boto config file.
If there is already a device mounted at the specified mount point,
the installer assumes that it is the ephemeral drive and unmounts
it, remounts it as /tmp and chmods it to 777.
Config file section::
[EBS]
volume_id =
logical_volume_name =
device =
mount_point =
iÿÿÿÿN( t Volume( t EC2ResponseError( t Installer( t Templates_ #!/usr/bin/env python
# Backup EBS volume
import boto
from boto.pyami.scriptbase import ScriptBase
import traceback
class Backup(ScriptBase):
def main(self):
try:
ec2 = boto.connect_ec2()
self.run("/usr/sbin/xfs_freeze -f ${mount_point}", exit_on_error = True)
snapshot = ec2.create_snapshot('${volume_id}')
boto.log.info("Snapshot created: %s " % snapshot)
except Exception, e:
self.notify(subject="${instance_id} Backup Failed", body=traceback.format_exc())
boto.log.info("Snapshot created: ${volume_id}")
except Exception, e:
self.notify(subject="${instance_id} Backup Failed", body=traceback.format_exc())
finally:
self.run("/usr/sbin/xfs_freeze -u ${mount_point}")
if __name__ == "__main__":
b = Backup()
b.main()
sœ #!/usr/bin/env python
import boto
from boto.manage.volume import Volume
# Cleans Backups of EBS volumes
for v in Volume.all():
v.trim_snapshots(True)
sr #!/usr/bin/env python
import boto
# Cleans Backups of EBS volumes
ec2 = boto.connect_ec2()
ec2.trim_snapshots()
t EBSInstallerc B se e Z d Z d
d „ Z d „ Z d „ Z d „ Z e d „ Z d „ Z
d „ Z d „ Z d „ Z
RS( s
Set up the EBS stuff
c C s˜ t t | ƒ i | ƒ t i i d d ƒ | _ t i i d d d ƒ | _ t i i d d ƒ | _ t i i d d ƒ | _ t i i d d d ƒ | _
d S(
Nt Instances instance-idt EBSt devices /dev/sdpt volume_idt logical_volume_namet mount_points /ebs( t superR t __init__t botot configt gett instance_idR R R R
( t selft config_file( ( sD /usr/lib/python2.6/site-packages/boto/pyami/installers/ubuntu/ebs.pyR h s c C sÇ t i ƒ } | i o+ t t i d | i ƒ ƒ } | i | _ n | i | i g ƒ d } xE | i ƒ d j o1 t i
i d | i | i
f ƒ t i d ƒ q] W| i | i g ƒ d } t } x— | o y&