AWS CLI EC2 Cheat Sheet/Attach a volume

Attach an existing EBS volume to an instance.

Section: EBS Volumes and Snapshots

Attach a volume

bash
bash
aws ec2 attach-volume --volume-id vol-0123456789abcdef0 --instance-id i-0123456789abcdef0 --device /dev/xvdf
Explanation

The operating system still needs filesystem and mount configuration if appropriate.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing EBS Volumes and Snapshots
Describe EBS volumes
List attached and unattached EBS volumes.
OpenIn sheetbashsame section
Create an EBS volume
Create a new volume in a specific AZ.
OpenIn sheetbashsame section
Create a snapshot
Snapshot an EBS volume.
OpenIn sheetbashsame section
Describe snapshots
List snapshots visible to the account.
OpenIn sheetbashsame section
Delete a snapshot
Remove a no-longer-needed snapshot.
OpenIn sheetbashsame section
Describe instances
List EC2 instances and their attributes.
OpenIn sheetbash2 tag match