Skip to content

/AWS1/CL_EC2=>ATTACHVOLUME()

About AttachVolume

Attaches an EBS volume to a running or stopped instance and exposes it to the instance with the specified device name.

Encrypted EBS volumes must be attached to instances that support Amazon EBS encryption. For more information, see Amazon EBS encryption in the Amazon EBS User Guide.

After you attach an EBS volume, you must make it available. For more information, see Make an EBS volume available for use.

If a volume has an Amazon Web Services Marketplace product code:

  • The volume can be attached only to a stopped instance.

  • Amazon Web Services Marketplace product codes are copied from the volume to the instance.

  • You must be subscribed to the product.

  • The instance type and operating system of the instance must support the product. For example, you can't detach a volume from a Windows instance and attach it to a Linux instance.

For more information, see Attach an Amazon EBS volume to an instance in the Amazon EBS User Guide.

Method Signature

IMPORTING

Required arguments:

IV_DEVICE TYPE /AWS1/EC2STRING /AWS1/EC2STRING

The device name (for example, /dev/sdh or xvdh).

IV_INSTANCEID TYPE /AWS1/EC2INSTANCEID /AWS1/EC2INSTANCEID

The ID of the instance.

IV_VOLUMEID TYPE /AWS1/EC2VOLUMEID /AWS1/EC2VOLUMEID

The ID of the EBS volume. The volume and instance must be within the same Availability Zone.

Optional arguments:

IV_DRYRUN TYPE /AWS1/EC2BOOLEAN /AWS1/EC2BOOLEAN

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

RETURNING

OO_OUTPUT TYPE REF TO /AWS1/CL_EC2VOLUMEATTACHMENT /AWS1/CL_EC2VOLUMEATTACHMENT