fbpx

Backup AWS Ephemeral Storage of an EC2 Instance

blog banner bg 4
A part one of the two-part blog post series describing the advantages of the AWS ephemeral storage solution. Includes reasons for choosing AWS ephemeral storage, as well as a use case of backing up an MYSQL database on EC2 backup instance using ephemeral storage.
Share This Post

Today, most cloud storage solutions are designed for persistence in order for them to be sustained through any type of failure. AWS provides distinct types of storage services that can be divided into two broader categories: persistent and ephemeral. Persistent storage is useful for Filesystem, database storage, analysis, IoT data, distribution of content, backups, and more. Amazon EBSAmazon S3, and Amazon EFS are highly fault-tolerant persistent storage options. Amazon EC2 instance storage is an AWS ephemeral storage option. In this two-part series, we will look more closely at uses for ephemeral storage and examine a particular use case—how to back up MySQL data from the instance store storage to EBS. We will also illustrate how to automate this process using N2WS Backup & Recovery (CPM).

Why Choose Ephemeral Storage

While every organization wants their data to be persistent, there are different use cases for which having persistent data is not a priority. For organizations that place more focus on processing data than storing it, for example, the Amazon EC2 instance store (ephemeral) is the ideal option. Consider the following additional potential uses:

  • To store cached data/logs of a website or web application.
  • To store buffer data or temporary analytics calculation data, such as Hadoop jobs.
  • To achieve fault-tolerant architecture. For example, it can be used as a root volume for instances under a load balancer if you don’t need the data to persist when instances host web servers.
  • Allows the user wants to reduce costs. EBS volumes as instance store volumes do not come with additional costs for storage.

That said, there are a few challenges that come with using ephemeral storage:

  • Instance store volumes are temporary, which means that if the instance is deleted by mistake or there is a failure of hardware, whole data will be lost.
  • If the instance store is attached as an additional volume to an EBS-backed instance for temporary storage, every start and stop of the instance will reset the data.

Instance store volumes are temporary block level storage physically attached to the EC2 instance backup. These directly attached disks also are shared between multiple virtual machines on a single host. A single instance can have one or more instance store volumes attached to it. These are exposed as block devices to the instance. Volumes of these instance store range from 0-23 and are labeled as ephemeral 0 all the way to ephemeral 23. The number of devices allowed and maximum size of that instance store device depends on the type of EC2 instance. As we know, an instance store device is dedicated to a particular instance, but the disk from where that instance storage is created is shared among multiple instances as part of a virtualization technique used by AWS. The diagram below illustrates a host computer/hardware in which multiple instances share the same disk though they will have their own directly attached dedicated instance store volume provided from the same disk. Instance Store Ideology diagram As storage offered via instance store is for temporary use, to persist any data stored on it, a backup of the data on persistent storage, such as EBS, is required.

Use Case with MySQL Database

Follow the steps below:

  1. Create an EC2 instance with an instance store volume attached.
  2. Set up a MySQL database and enter some data.
  3. Attach an EBS volume to the same instance to take MySQL dumps.
  4. Write a before script in CPM that will copy database backup to EBS directly before backup.
  5. Set up CPM with EBS automated backup.

It is often recommended that a database should be stored on persistent storage only, but if you plan well, including for backup and limitation of ephemeral storage, you can take advantage of this type of storage, too. Instance store-backed storage is really fast in terms of reads and writes, which makes it optimal for running MySQL. Furthermore, according to tests performed by various AWS community professionals:

  • An instance store is over 5x faster than EBS-SSD for uncached reads.
  • An instance store is over 10x faster than EBS-SSD for writes.

For more about tests, check out EC2 EBS-SSD vs instance-store performance on an EBS-optimized. In part two of the series, we will demonstrate how to perform an automated backup with EBS. In part two of the series, we will demonstrate how to perform an automated backup with EBS. Try N2WS Backup & Recovery 2.4 for FREE!

Read Also

Next step

The easier way to recover cloud workloads

Allowed us to save over $1 million in the management of AWS EBS snapshots...

Try N2WS for Free