Scalr\Service\Aws\Ec2\DataType\InstanceData::attachVolume PHP Method

attachVolume() public method

Attaches an Amazon EBS volume to a running instance and exposes it to the instance with the specified device name. For a list of supported device names, see Attaching the Volume to an Instance. Any device names that aren't reserved for instance store volumes can be used for Amazon EBS volumes. Note! If a volume has an AWS Marketplace product code: -The volume can only be attached to the root device of a stopped instance. -You must be subscribed to the AWS Marketplace code that is on the volume. -The configuration (instance type, operating system) of the instance must support that specific AWS Marketplace code. For example, you cannot take a volume from a Windows instance and attach it to a Linux instance. -AWS Marketplace product codes are copied from the volume to the instance.
public attachVolume ( string $volumeId, string $device ) : AttachmentSetResponseData
$volumeId string The ID of the Amazon EBS volume. The volume and instance must be within the same Availability Zone
$device string The device name as exposed to the instance
return AttachmentSetResponseData Returns AttachmentSetResponseData on success
    public function attachVolume($volumeId, $device)
    {
        $this->throwExceptionIfNotInitialized();
        return $this->getEc2()->volume->attach($volumeId, $this->instanceId, $device);
    }