Attaching a Volume to an Instance
You can attach a volume to an instance within the same Availability Zone (AZ) to add additional storage. You can attach several volumes to an instance (up to 40), for example to separate different types of data. For more information, see About Volumes > Volumes Attachment and Device Names.
Attaching a Volume to an Instance Using Cockpit v1
-
Click Storage > Volumes.
You can also select an instance in the Instances page and click Attach Volume(s) .
-
Click the volume you want to attach to an instance.
The volume is selected. -
Click Attach .
The ATTACH VOLUME dialog box appears. -
In the Instance list, click the instance you want to attach the volume to.
Only the instances that are in the same Availability Zone as the volume you want to attach appear in the list.
-
In the Device list, click the device name you want to assign to the volume.
-
Click Attach.
The volume is attached to the selected instance. -
To make the volume available for use, format and mount it to the instance. For more information, see Initializing a Volume from an Instance.
Linking a Volume to a VM Using OSC CLI
See the LinkVolume command sample in the documentation of the OUTSCALE API. |
Attaching a Volume to an Instance Using AWS CLI
-
To attach a volume to an instance, use the attach-volume command following this syntax:
Request sample$ aws ec2 attach-volume \ --profile YOUR_PROFILE \ --volume-id vol-12345678 \ --instance-id i-87654321 \ --device /dev/xvdb \ --endpoint https://fcu.eu-west-2.outscale.com
This command contains the following attributes that you need to specify:
-
(optional)
profile
: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI. -
volume-id
: The ID of the volume. -
instance-id
: The ID of the instance. -
device
: The device name you want to assign to the volume.You must use /dev/xvdX or /dev/xvdXX device names. For more information, see About Volumes > Volumes Attachment and Device Names.
-
endpoint
: The endpoint corresponding to the Region you want to send the request to.
The attach-volume command returns a result as follows:
-
AttachTime
: The time at which the attachment was initiated. -
InstanceId
: The ID of the instance. -
VolumeId
: The ID of the volume. -
State
: The attachment state of your volume (attaching
|detaching
|attached
|detached
). -
Device
: The device name you specified when attaching the volume.Result sample{ "AttachTime": "2016-02-05T13:56:48.970Z", "InstanceId": "i-87654321", "VolumeId": "vol-12345678", "State": "attaching", "Device": "/dev/xvdb" }
The volume is attached to the specified instance.
-
-
To make the volume available for use, format and mount it to the instance. For more information, see Initializing a Volume from an Instance.
Related Pages
Corresponding API Methods
AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.