Here are my notes on EC2 Instance storage based on the following documentation -
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html
What is Instance Storage ?
Instance storage is storage that is automatically available when an EC2 instance is instantiated. The type of instance determines how many instance storages are available per instance.
Instance storage is not recommended for long term data persistence as data is deleted after an instance has been stopped or terminated. Data however, will survive a reboot.
Advantages
- Network Latency
- The advantage of using an instance store is lower network latency since this storage is physically on the same machine as the instance.
- Cost
- The cost of an instance store is already factored into the cost of the instance, so it makes economic sense for an implementation that doesn't require data to be persisted.
Block Mapping Limits
Each instance type has a limit on the number of instance storages that can be attached. Anything specified in the Block Mapping at the time instance instantiation is ignored if it is over that limit. HS1 instances on the other hand will attach the max number of instance storages available and they need to be explicitly removed from the block mappingSSD Instance Storage
At the time of writing these notes, there are two types of SSD storages available -- NVMe (Non Volatile Memory express)
- NVMe storage is automatically encrypted via a hardware module that also generates the key. This key cannot be supplemented with a customer provided key
- Non-NVMe
Trim Support
Some Instance Storage options provide TRIM Support. It turns out that garbage collection on SSD drives can be write intensive and data deletion can lead to write amplification. TRIM support provides commands that free up space while reducing write amplification.
Write First Penalty
Because of the way AWS virtualizes its storage, writing data for the first time can incur write first penalty.This can be avoided by initializing the storage by issuing a few commands.
Certain instance types that have attached SSD storage and TRIM support do not require this special initialization.