EC2 instance store is temporary block storage on disks that are physically attached to the host computer running your instance. It is very fast and has no separate charge, but its data is lost when the instance stops, hibernates or terminates, or when the underlying drive fails. Use ec2 instance store for caches, buffers, scratch space and data that is replicated elsewhere, and use EBS for anything you must keep.
Most EC2 storage is Amazon EBS: a network-attached volume that lives independently of the instance. Instance store is different. The disks sit inside the same server as your virtual machine, so reads and writes do not cross the network. That gives high throughput and low latency, especially on NVMe SSD instance types built for storage.
Instance store is available only on certain instance types. Look for a d in the name, such as m5d, c6id or r6gd, or storage-optimised families such as i3, i4i and im4gn. The number and size of volumes depend on the instance size. Many other types, such as plain m5 or t3, have no instance store at all.
This is the rule that matters most:
| Event | Instance store data |
|---|---|
| Reboot | Kept |
| Stop | Lost |
| Hibernate | Lost |
| Terminate | Lost |
| Underlying disk or host failure | Lost |
| Instance moved to new host after stop and start | Lost, you get new empty volumes |
Because a reboot keeps the data, it is tempting to treat the disk as durable. Do not. Hardware fails without warning, and an Auto Scaling group may terminate an instance at any time.
| Question | Instance store | EBS |
|---|---|---|
| Persistence | Ephemeral | Independent of the instance |
| Cost | Included in the instance price | Billed per GB and per provisioned performance |
| Snapshots | Not supported | Supported |
| Detach and reattach | Not possible | Possible |
| Add after launch | No, only at launch | Yes |
| Resize | No | Yes, online for most types |
| Latency | Lowest, local disk | Low, over the network |
Instance store volumes cannot be snapshotted, detached or moved to another instance. If you need a backup, copy the data to S3 or EBS yourself.
Pick it when the data is cheap to lose or already stored elsewhere:
Avoid it for a single-copy database, user uploads, configuration you cannot regenerate, or the only copy of anything.
You choose to launch an instance type that has instance store; the volumes are attached automatically, but they are not formatted or mounted. On Linux:
The 8 GiB device is the EBS root volume. The larger unmounted device is instance store.
/etc/fstab entries for a device that may be absent, or add nofail.Device names for NVMe instance store can change between boots, so for stronger scripts match on the model string shown by lsblk -o NAME,MODEL, which reads "Amazon EC2 NVMe Instance Storage".
When you launch with a block device mapping, instance store volumes are named in the launch request as ephemeral0, ephemeral1 and so on. For NVMe types all volumes are attached automatically regardless of the mapping.
On current Nitro-based instance types, NVMe instance store volumes are encrypted at rest using a hardware-based algorithm, and the key is destroyed when the instance stops or terminates. You cannot turn this off. AWS also wipes the disks before reallocating them to another customer, so previous data is not exposed. Still, encrypt anything sensitive at the application level if your compliance rules require control of the key.
No. A reboot keeps the data, but stop, hibernate, terminate and hardware failure all erase it.
No. Instance store volumes are decided at launch by the instance type and the block device mapping. To get one, launch a different instance.
No. Copy the files to S3 or an EBS volume with a tool such as aws s3 sync or rsync.
It is included in the hourly price of the instance type. You cannot buy it separately and you cannot pay less by leaving it unused.
EC2 instance store gives you fast, local, temporary disks that cost nothing extra but lose their data on stop, terminate or hardware failure. Choose it for caches, scratch space and replicated data, format and mount it from user data on every launch, and keep anything durable on EBS, EFS or S3.