I am trying to attach an EBS volume on EC2 (RHEL) instance. This is how my attach-volume command looks like:
aws ec2 attach-volume --volume-id vol-xxxxxxxxxxxxxxxxx --instance-id i-yyyyyyyyyyyyyyyyy --device /dev/sdf
{
"AttachTime": "2021-12-02T19:30:13.070000+00:00",
"Device": "/dev/sdf",
"InstanceId": "i-yyyyyyyyyyyyyyyyy ",
"State": "attaching",
"VolumeId": "vol-xxxxxxxxxxxxxxxxx "
}
this is the output of lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme1n1 259:0 0 5G 0 disk
└─aaaaa-aaa 253:2 0 5G 0 lvm /logs
nvme0n1 259:1 0 10G 0 disk
├─nvme0n1p1 259:2 0 1M 0 part
└─nvme0n1p2 259:3 0 10G 0 part /
nvme3n1 259:4 0 35G 0 disk
├─bbbbb-bbb 253:3 0 8G 0 lvm [SWAP]
├─bbbbb-ccc 253:4 0 4G 0 lvm /var/tmp
├─bbbbb-ddd 253:5 0 4G 0 lvm /var
├─bbbbb-eee 253:6 0 4G 0 lvm /var/log
nvme2n1 259:5 0 5G 0 disk
└─ccccc-ffff 253:0 0 5G 0 lvm /products
nvme4n1 259:6 0 5G 0 disk
└─ddddd-gggg 253:1 0 5G 0 lvm /apps
nvme5n1 259:7 0 20G 0 disk
Even though I specified device name as /dev/sdf, it shows up as nvme5n1. This makes it difficult for me to identify the newly attached EBS volume and mount it.
I tried aws ec2 attach-volume --volume-id vol-xxxxxxxxxxxxxxxxx --instance-id i-yyyyyyyyyyyyyyyyy --device /dev/nvme5n1 but that gives me an error saying /dev/nvme5n1 is not a valid EBS device name.
Is there a way I can identify the right name of the EBS volume I just attached so that I can mount it to the directory I desire?