Type of disk attached to an instance

0

Hello. Is there an easy way to find out if the disk attached to an instance is gp2, gp3 or io1? I'd like to know how to do this both from the console and once I'm connected to the instance. The console simply shows:

Root device type			ebs
Root device				/dev/sda1
Block devices				/dev/sda1
					/dev/sdb
Elastic Graphics ID			-
Elastic Inference accelerator ID	-
Capacity Reservation			-
Capacity Reservation Settings		Open
Outpost Arn				-```
afody
已提問 2 年前檢視次數 684 次
3 個答案
3
已接受的答案

Here is a command you can run to show this information. Replace $INSTANCE_ID below with your instance ID.

aws ec2 describe-volumes --filters Name=attachment.instance-id,Values=$INSTANCE_ID --query '[Volumes[*].VolumeId,Volumes[*].Attachments[0].InstanceId,Volumes[*].Attachments[0].Device,Volumes[*].VolumeType]' --output text

Each volume attached to the instance will be in a separate column. The row values are the volume ID, instance ID, device attachment, and volume type. For example:

vol-xxxxxxxxxxx   vol-zzzzzzzzz
i-yyyyyyyyy     i-yyyyyyyyy
/dev/xvda       /dev/sdf
gp2     gp3
AWS
專家
已回答 2 年前
profile pictureAWS
專家
已審閱 2 年前
  • It worked. Thanks.

1

Hi, good question. You can do this on the new AWS Management console by viewing volumes, where this will list information such as size, volume type, whether the volume is encrypted, which KMS key was used to encrypt the volume, and the specific instance to which it is attached.

Via CLI: describe-volumes

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-describing-volumes.html

jsonc
已回答 2 年前
  • I switched to the new console but, somehow, when I click on the volume, the page goes blank (not sure why). I'll try with a different instance later. (I'm trying not to use the CLI for reasons that would take me a while to explain)

1

To look it up by volume device name (/dev/nvme1n1 in my example), use the following command:

lsblk -P -o SERIAL /dev/nvme1n1 |cut -d "\"" -f 2 | sed "s/vol/vol-/" | xargs aws ec2 describe-volumes --volume-ids --query "Volumes[*].VolumeType" --output text

The command will return the volume type:

gp3
AWS
kdavyd
已回答 2 年前
  • It worked. Thanks.

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南