简体   繁体   中英

How to know ebs device name in cloudformation template before creation of ec2 instance

I'm taking reference from https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-blockdevicemappings in order to create a new instance.

While creating from portal there's an option to increase the size of OS disk(root disk). And after the instance boots it generally has this mount

/dev/nvme0n1p1                         970G  129G  842G  14% /

I want to specify the size of OS disk in template but the block device attribute has DeviceName field

在此处输入图像描述

How do I know prior to the creation of vm if the DeviceName would be /dev/nvme0n1p1 ? Or can it be named anything and the template will consider it as the size to give to the OS disk?

Will specifying BlockDeviceMapping add a new disk or expand the OS disk?

The NVMe device names aren't stable.

As mentioned here :

In Linux, NVMe device names follow the pattern /dev/nvme<x>n<y>, where <x> is the enumeration order, and, for EBS, <y> is 1. Occasionally, devices can respond to discovery in a different order in subsequent instance starts, which causes the device name to change.

In order to map the device name returned by the attach-volume API (eg /dev/sdh ) to the NVMe disk name see the answer here .

Note that /dev/nvme0n1p1 (what you have above) is a disk partition for the /dev/nvme0n1 disk.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM