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
AttachmentLimitExceedederror. For more information, see Instance volume limits. -
You can attach volumes to instances that are in the same Availability Zone only.
-
Multi-Attach enabled volumes can be attached to up to 16 instances. For more information, see Attach an EBS volume to multiple EC2 instances using Multi-Attach.
-
If the volume has an AWS Marketplace product code:
-
You can attach it to a stopped instance only.
-
You must be subscribed to the AWS Marketplace code that is on the volume.
-
The instance's configuration, such as its type and operating system, 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 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/xvdaor/dev/sdacan 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. -
Some instance types support more than one EBS card. You can select the EBS card for the volume to be attached to by specifying the EBS card index. For instances support multiple EBS cards, see EBS cards.
-
Your root volume must be attached to EBS card index
0. -
For the instances that support multiple EBS cards, If you do not specify the EBS card index, your volume will be attached to EBS card index
0. -
When configuring your EC2 instances for high-performance workloads, it is essential to balance EBS volumes across EBS cards based on performance requirements, to avoid running into performance limits on any of the EBS cards.
-
The volume attachment limit for an instance type is spread equally across each EBS card. For example, on an EC2 instance that supports
128volume attachments with 2 EBS cards, each EBS card can support up to64volume attachments. If you exceed the EBS card attachment limit, the request fails with theCardAttachmentLimitExceedederror.
-