Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determining if ephemeral storage is attached to an instance in Amazon Web Services console?

Short question:

How do I know if an instance has ephemeral storage attached? Do I have to ssh in and look at the mounts with lsblk on Linux?

Since ephemeral storage is lost when an instance is stopped, you need to know if ephemeral drives are attached at all. The first thing to check is the "root device type" of the instance, if it is EBS, then you don't have to worry about losing data (unless the EBS volume is set to 'delete on terminate').

However, if it is "instance-store" you will lose the data on that drive when the instance starts. Then look at the "root device" and "block devices" and see if they are all associated with EBS volumes. That's easy. Where it gets cloudy, is when you attach an ephemeral drive to an instance (at launch time), but the console doesn't represent it like it does for an additional EBS volume. Further, you may need to manually mount the drive yourself...

How can you easily know from the AWS Console if an ephemeral drive is attached?

like image 429
mytwocents Avatar asked Aug 12 '14 21:08

mytwocents


People also ask

Which of these is an ephemeral storage that can be attached with an EC2 instance?

6 Answers. Save this answer. Show activity on this post. Basically, root volume (your entire virtual system disk) is ephemeral, but only if you choose to create AMI backed by Amazon EC2 instance store.

Which form of AWS storage is considered ephemeral?

An instance store consists of one or more instance store volumes exposed as block devices. The size of an instance store as well as the number of devices available varies by instance type. The virtual devices for instance store volumes are ephemeral[0-23] .

How do I know if my EBS is attached to EC2?

Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/ . In the navigation pane, choose Instances. Select the instance. On the Storage tab, the Block devices section lists the volumes that are attached to the instance.

What is ephemeral storage in EC2?

Ephemeral storage is the volatile temporary storage attached to your instances which is only present during the running lifetime of the instance. In the case that the instance is stopped or terminated or underlying hardware faces an issue, any data stored on ephemeral storage would be lost.


2 Answers

On any ec2 instance you can call an http service to query for the instance details, e.g. to see attached block devices mapping:

curl http://169.254.169.254/latest/meta-data/block-device-mapping/

to see details about a specific device:

curl http://169.254.169.254/latest/meta-data/block-device-mapping/ephemeral2

You will get the mapping of this device, e.g.: /dev/xvdb

like image 191
Radoslaw Garbacz Avatar answered Sep 21 '22 15:09

Radoslaw Garbacz


Look in /etc/cloud/cloud.cfg - the ephemeral should be listed there like:

mounts:
 - [ ephemeral0, /media/ephemeral0, auto, "defaults" ]
 - [ swap, none, swap, sw, "0", "0" ]

Then in /etc/fstab you should see an entry like:

/dev/sda2   /media/ephemeral0   auto    defaults,comment=cloudconfig    0   2
like image 35
figtrap Avatar answered Sep 22 '22 15:09

figtrap