Why can't I attach my Amazon EBS volume to my Amazon EC2 instance?

3 minute read
0

I want to attach my Amazon Elastic Block Store (EBS) volume to my Amazon Elastic Compute Cloud (Amazon EC2) instance but it fails.

Resolution

The following are common reasons why you can't attach your Amazon EBS volume to your Amazon EC2 Instance.

Your EC2 instance and EBS volume are in different Availability Zones

EBS volumes are specific to the Availability Zone that you create them in. Make sure that the instance that you want to attach your volume to is in the same Availability Zone. To determine the Availability Zones that are available for your AWS account, see Available Availability Zones. To check the Availability Zone that your volume is in, see View information about an Amazon EBS volume.

The device name that you specified is already in use

When you attach a volume to an instance, you provide a device name for the volume that Amazon EC2 uses. Amazon EC2 doesn't allow you to use duplicate device names. If the device name is already in use, then the operation fails with the following error:

"Invalid value '/dev/abc' for unixDevice. Attachment point /dev/abc is already in use"

To resolve this error, choose a different device name. For more information, see Device names for volumes on Amazon EC2 instances.

Sometimes, if a volume is forcefully detached from an EC2 instance, then the block device driver might continue to use the device name. Therefore, you can't use the device name for that volume. You must choose a different device name, or reboot the instance.

For more information, see Detach an Amazon EBS volume from an Amazon EC2 instance.

Either the volume or the instance is in an incorrect operating state

You can attach a volume to an instance only when the instance is in the running or stopped state. You can't attach a volume when the instance is in the pending or stopping state. Also, the volume must be in the available state when you attach it to the instance.

If the volume is stuck in the attaching state, then see Why is my EBS volume stuck in the attaching state?

Amazon EC2 reached the maximum instance volume limit

The maximum number of volumes that an instance supports depends on the type of instance and operating system. If your volume attachment fails and you don't receive an error message, then check the instance volume limits.

The volume has an AWS Marketplace product code

If your volume has an AWS Marketplace product code, then you must subscribe to the AWS Marketplace code that's on the volume. Also, the instance configuration must adhere to that AWS Marketplace code's requirements. For more information, see For more information, see the Considerations section in Attach an Amazon EBS volume to an Amazon EC2 instance.

Your IAM user or role doesn't have the permission to perform the AttachVolume action

Amazon EC2 uses the AttachVolume API to attach an EBS volume to an instance. Your Identity and Access Management (IAM) user or role might not have the IAM policy permission to perform the AttachVolume API action. Or, an AWS Organizations service control policy (SCP) might restrict your IAM user or role. You receive the following error: "You are not authorized to perform this operation. Encoded authorization failure message..."

To resolve this issue, see How can I troubleshoot access denied or unauthorized operation errors with an IAM policy?https://docs.aws.amazon.com/ebs/latest/userguide/ebs-attaching-volume.html

AWS OFFICIAL
AWS OFFICIALUpdated 7 months ago