class EbsSnapshotter::Snapshotter
Public Class Methods
new(config_path, volume_id)
click to toggle source
# File lib/ebs_snapshotter/snapshotter.rb, line 7 def initialize(config_path, volume_id) @volume_id = volume_id @aws_config = YAML::load(File.open(config_path)) end
Public Instance Methods
snapshot()
click to toggle source
# File lib/ebs_snapshotter/snapshotter.rb, line 12 def snapshot new_snapshot = connection.snapshots.new new_snapshot.description = "#{@volume_id} - #{Time.now}" new_snapshot.volume_id = @volume_id saved = new_snapshot.save raise "Failed to save snapshot for #{@volume_id}" unless saved end
Private Instance Methods
connection()
click to toggle source
# File lib/ebs_snapshotter/snapshotter.rb, line 22 def connection @connection ||= Fog::Compute.new(@aws_config[:fog]) end