Method: Fog::Compute::AWS::Real#attach_volume

Defined in:
lib/fog/compute/requests/aws/attach_volume.rb

#attach_volume(instance_id, volume_id, device) ⇒ Object

Attach an Amazon EBS volume with a running instance, exposing as specified device

Parameters

  • instance_id<~String> - Id of instance to associate volume with

  • volume_id<~String> - Id of amazon EBS volume to associate with instance

  • device<~String> - Specifies how the device is exposed to the instance (e.g. “/dev/sdh”)

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘attachTime’<~Time> - Time of attachment was initiated at

      • ‘device’<~String> - Device as it is exposed to the instance

      • ‘instanceId’<~String> - Id of instance for volume

      • ‘requestId’<~String> - Id of request

      • ‘status’<~String> - Status of volume

      • ‘volumeId’<~String> - Reference to volume

Amazon API Reference



26
27
28
29
30
31
32
33
34
35
# File 'lib/fog/compute/requests/aws/attach_volume.rb', line 26

def attach_volume(instance_id, volume_id, device)
  request(
    'Action'      => 'AttachVolume',
    'VolumeId'    => volume_id,
    'InstanceId'  => instance_id,
    'Device'      => device,
    :idempotent   => true,
    :parser       => Fog::Parsers::Compute::AWS::AttachVolume.new
  )
end