AWS EC2 Instance Store

Postgraduate in Communications Engineering with working experience in the Support Desk and self-study in software development.
Search for a command to run...

Postgraduate in Communications Engineering with working experience in the Support Desk and self-study in software development.
The git log command is used to view the commit history of a Git repository. You can customize the output format to show specific details in a more readable or structured way. Below are some useful variations and formatting options for git log: To sh...

Overview This article will teach us how to: Install Ubuntu Server 24.04 on a laptop from scratch Install Ubuntu server by using Vagrant tool with ISO image Prerequisites: A laptop without any OS installed; A virtualization software Virtualbox t...

The /etc/passwd and /etc/shadow files are the backbone of Linux user management. Together, they store user account information and handle authentication securely. This article provides a hands-on guide to understanding these files, their structure, a...

In Linux, links are powerful tools that allow you to create references to files and directories. There are two main types of links: hard links and soft links (also known as symbolic links or symlinks). Understanding the differences between these two ...

A hostname is a human-friendly name given to a computer. It is a unique identifier that allows us to identify the machine in various network communications, making it easier to locate and manage devices. Type: hostname To see where it is stored, typ...

EC2 Instance Store is a type of storage that's physically attached to the host computer for the EC2 instance. Data on instance store volumes is temporary, meaning data can be lost if the instance stops, terminates, or fails.
Instance Store volumes are either NVMe or non-NVMe. NVMe (Non-Volatile Memory Express) is a protocol specifically designed for solid-state storage to make use of the capabilities of high-speed PCIe bus standards. Typically, they offer better performance compared to non-NVMe volumes due to the advantages of the NVMe protocol. They provide lower latencies and higher IOPS.
Performance. Instance store provides high IOPS (input/output operations per second) and low-latency performance because it’s directly attached to the host.
No Additional Cost: Instance store volumes are included as part of the instance’s hourly cost. You pay for the EC2 instance, and the storage is bundled with it.
Ephemeral Nature: Data is lost on instance stop or termination. Always make sure to back up important data elsewhere.
Limited Size: The storage size is fixed depending on the instance type and can't be changed.
Not Detachable: You cannot detach an instance store from one instance and attach it to another.
Persistence: EBS volumes persist independently from the life of an instance, while instance store volumes are ephemeral.
Performance: The instance store may offer superior IOPS and throughput for certain workloads, but EBS has made significant strides, especially with its Provisioned IOPS and io2 block express volumes.
Features: EBS comes with features like snapshots, volume resizing, and the ability to detach/attach to different EC2 instances.
Cost: While the instance store is included in the instance price, EBS volumes have a separate cost based on provisioned storage and I/O.
The aim of this hands-on lab is to create an EC2 instance with instance store volumes, understand their temporary nature, and finally watch whether the data will be lost after the EC2 instance termination/stopped.
Create and launch an EC2 instance with the Instance type m1.small that supports an instance store volume. In the storage section, you'll notice the instance store volumes attached to this instance type.

Once the instance is running, connect to the instance using an SSH client or EC2 Connect.
Use the df -h command to view the volumes that are formatted and mounted.
Use the lsblk to view any volumes that were mapped at launch but not formatted and mounted.
To format and mount an instance store volume that was mapped only, do the following:
Create a file system on the device using the mkfs command.
[ec2-user ~]$ sudo mkfs -t xfs /dev/nvme1n1
Create a directory on which to mount the device using the mkdir command.
[ec2-user ~]$ sudo mkdir /data
Mount the device on the newly created directory using the mount command.
[ec2-user ~]$ sudo mount /dev/nvme1n1 /data
Navigate to the mounted directory, create a sample file, and confirm the data:
cd /data
echo "This is instance store data" > sample.txt
cat sample.txt
From the EC2 Dashboard or using the CLI, stop the EC2 instance and start the instance again.
SSH back into the EC2 instance and navigate to
cd /data
ls
You'll observe that the data is gone.
Instance store volumes provide temporary block-level storage for instances. The data on an instance store volume persists only during the life of its associated instance. If you stop or terminate an instance, the data on its instance store volumes is lost. This exercise gives a practical understanding of this characteristic. Remember to always back up data that you cannot afford to lose and consider using persistent storage options like Amazon EBS for long-term data storage.