Class: RightAws::Ec2

Inherits:
Object
  • Object
show all
Defined in:
lib/souffle/provider/aws.rb

Overview

Monkeypatch RightAws to support EBS delete on termination.

Instance Method Summary collapse

Instance Method Details

#modify_block_device_delete_on_termination_attribute(instance_id, device_name, delete_on_termination) ⇒ Object

Modifies an EBS device delete on termination flag.

Parameters:

  • instance_id (String)

    The instance id to associate with the EBS.

  • device_name (String)

    The name of the EBS device.

  • delete_on_termination (Boolean)

    Whether or not to delete on term.



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/souffle/provider/aws.rb', line 14

def modify_block_device_delete_on_termination_attribute(instance_id,
    device_name, delete_on_termination)
  request_hash = {'InstanceId' => instance_id}
  prefix = "BlockDeviceMapping.1"
  request_hash["#{prefix}.DeviceName"] = device_name
  request_hash["#{prefix}.Ebs.DeleteOnTermination"] = delete_on_termination
  link = generate_request('ModifyInstanceAttribute', request_hash)
  request_info(link, RightAws::RightBoolResponseParser.new(
    :logger => @logger))
rescue Exception
  on_exception
end