Attach an Amazon EBS volume to an Amazon EC2 instance
You can attach an available EBS volume to one or more of your instances that is in the same Availability Zone as the volume.
For information about adding EBS volumes to your instance at launch, see instance block device mapping.
Considerations
-
The maximum number of Amazon EBS volumes that you can attach to an instance depends on the instance type. If you exceed the volume attachment limit for an instance type, the attachment request fails with the
AttachmentLimitExceeded
error. For more information, see Instance volume limits. -
You can attach volumes to instances that are in the same Availability Zone only.
-
If the volume has an Amazon Web Services Marketplace product code:
-
You can attach it to a stopped instance only.
-
You must be subscribed to the Amazon Web Services Marketplace code that is on the volume.
-
The instance's configuration, such as its type and operating system, must support that specific Amazon Web Services Marketplace code. For example, you cannot take a volume from a Windows instance and attach it to a Linux instance.
-
Amazon Web Services Marketplace codes are copied from the volume to the instance.
-
-
This device name you specify is used by Amazon EC2. The block device driver can mount the device with a device name that is different from the one you specify. For more information, see Device names for volumes on Amazon EC2 instances.
-
In some cases, a volume other than the volume attached to
/dev/xvda
or/dev/sda
can become the root volume for the instance. This can happen if you attach the root volume of another instance, or a volume created from the snapshot of a root volume, to an instance with an existing root volume. For more information, see Boot from the wrong volume.