Adding Instance Storage to an AWS EC2 Virtual Machine Instance
Along with EC2 Elastic Block Storage (EBS) for persistent block storage, users can create one or more instance stores.
Normally when you create a new virtual machine (VM) instance in EC2 in the AWS cloud, that instance uses Elastic Block Storage (EBS). EBS might best be described as persistent block storage. However, EBS is not the only type of storage that is available to EC2 instances. The other option is to create one or more instance stores.
EBS volumes exist separately from the VM instance. For example, it is possible to delete an instance without deleting its EBS volume (although the EBS volume is normally deleted automatically when its instance is terminated). It's also possible to disconnect an EBS volume from one instance and connect it to another.
An instance store is different. Whereas EBS volumes are externally connected to an instance, an instance store uses local storage within the host on which the instance is running. Depending on the instance type, this storage can be based on NVMe or SATA SSDs.
Because the instance store exists locally within the host on which the instance is running, the instance store acts as very low latency storage. Even so, those latency gains come at a cost. Namely, the instance store is not persistent.
Suppose for a moment that you were to stop an instance and then later start it back up. There is no guarantee that the newly restarted instance would be running on the same host as it was running on before. As such, the instance would not have access to any volumes residing on local storage. That's why the instance store is temporary.
This raises two very important questions. First, what conditions cause the instance store contents to be lost, and second, what purpose does the instance store serve since it is non persistent?
In answer to the first question, the instance store's contents will be lost if the instance stops, is terminated, or goes into hibernation. There are also certain types of hardware failures that can cause an instance store's contents to be lost. It is worth noting however, that rebooting an instance does not cause the instance store's contents to be purged. This is because the reboot process never actually stops the instance, even if that reboot was unintentional or if the reboot occurred as the result of an error. As long as the instance remains running, its instance store contents will be preserved.
As far as the second question goes, you obviously would not want to store any important data in the instance store because that data could potentially be lost at any time. The instance store is best suited for use as a cache or for storing temporary files.
Another way that the instance store differs from normal EBS storage is in the way that volumes are created. Remember, the instance store only persists for as long as the instance is running. This means that you can only create an instance store when you are launching the instance. An instance store isn't something that you can add-on later.
One more important thing that you need to know about the instance store is that not every instance supports the use of an instance store. When you create a new instance from an Amazon AMI, you are prompted to choose an instance type. If you look at the Instance Storage column in the chart shown in Figure 1, you will notice that many instances only support EBS storage.
Figure 2 shows an example of an instance that includes an instance store. In this case, the root volume is a 30 GB EBS volume, but the instance store volume (listed as ephemeral0) is a 100 GB SSD-based, hardware encrypted volume. You will also notice in the figure that there is a Delete on Termination checkbox for the EBS volume, but not for the instance store volume, because instance stores by their very nature are always deleted on termination.
One more thing that you will notice about the figure is that there is a button that you can click to add a new volume. In most cases, you can only add additional EBS volumes. When you choose the instance type, the console will tell you how many instance stores are supported. The instance type that I chose in Figure 2 only supports a single instance store, meaning that there is no option to add another one. However, there are instance types that support two, four or even dozens of instance store volumes.
About the Author
Brien Posey is a 21-time Microsoft MVP with decades of IT experience. As a freelance writer, Posey has written thousands of articles and contributed to several dozen books on a wide variety of IT topics. Prior to going freelance, Posey was a CIO for a national chain of hospitals and health care facilities. He has also served as a network administrator for some of the country's largest insurance companies and for the Department of Defense at Fort Knox. In addition to his continued work in IT, Posey has spent the last several years actively training as a commercial scientist-astronaut candidate in preparation to fly on a mission to study polar mesospheric clouds from space. You can follow his spaceflight training on his Web site.