Class: VGH::APPS::EC2_Backup
- Inherits:
-
Object
- Object
- VGH::APPS::EC2_Backup
- Defined in:
- lib/vgh/apps/ec2_backup.rb
Overview
Description:
See EC2-Backup Section in the README file.
Usage:
backup = APPS::EC2_Backup.new
backup.run
Instance Attribute Summary collapse
-
#snapshot ⇒ Object
readonly
Snapshot Class.
-
#volumes ⇒ Object
readonly
Volumes Class.
Instance Method Summary collapse
-
#initialize ⇒ EC2_Backup
constructor
Initialize external classes.
-
#run ⇒ Object
Runs the ec2-backup app logic.
Constructor Details
#initialize ⇒ EC2_Backup
Initialize external classes
22 23 24 25 |
# File 'lib/vgh/apps/ec2_backup.rb', line 22 def initialize @volumes ||= EC2::Volume.new @snapshot = EC2::Snapshot.new end |
Instance Attribute Details
#snapshot ⇒ Object (readonly)
Returns Snapshot Class.
19 20 21 |
# File 'lib/vgh/apps/ec2_backup.rb', line 19 def snapshot @snapshot end |
#volumes ⇒ Object (readonly)
Returns Volumes Class.
16 17 18 |
# File 'lib/vgh/apps/ec2_backup.rb', line 16 def volumes @volumes end |
Instance Method Details
#run ⇒ Object
Runs the ec2-backup app logic
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/vgh/apps/ec2_backup.rb', line 28 def run System.lock volumes.list.map {|vid| snapshot.snap_and_tag( vid, "Backup for #{vid}(#{volumes.name_tag(vid)})", { 'Name' => fqdn, 'BACKUP' => "#{vid}" } ) snapshot.purge_backups } System.unlock end |