We're live-coding on Twitch! Join us!
Selecting AWS EC2 Instance Types for Database Storage

Selecting AWS EC2 Instance Types for Database Storage

There are hundreds of database solutions out there. Selecting the right database system for an application requires identifying the quality attributes it needs to fulfill while identifying the trade-offs of each attribute like reliability, performance, costs, efficiency and more. In addition, it is also important to identify suitable deployment resources, architecture as well as configurations for the database system to work as expected.

When it comes to AWS, there are managed services that take the responsibility for managing the underlying configurations and infrastructure for the Database systems. Using the managed services like AWS RDS, AWS Elasticache (Redis) is the recommended approach when provisioning database systems in AWS. However, there are situations where custom extensions and more control over the Database is needed. In addition, not all the database systems supported in AWS.

Therefore it is also important to understand the considerations when selecting AWS EC2 Instance Types for database storage and backup operations. This article provides a general guide in selecting AWS EC2 Instance Types for common database systems as well as for different database storage architectures.

Selecting EC2 Storage

In AWS there are different physical disk storage types available. This includes Solid State Drives (SSD), Hard Disk Drives (HDD) and NVM Express (NVMe SSD) storage technologies. These physical storage devices are available to EC2 instances in different forms.

Instance Storage Volumes

These volumes can be specified only when you launch the EC2 instance. You cannot detach it or attach it to a different instance. The data in an instance volume persists only during the lifetime of its associated EC2 instance. If an EC2 instance reboots, data in the instance store persists but it will be lost if the instance is stopped, terminated or underlying physical device fails. Some of the physical storage technologies such as NVMe SSD is only available for instance storage. Instance storage can be used for high performance and in memory storage servers but it is important to design fault-tolerant architectures to avoid losing data.

Elastic Block Storage (EBS) Volumes

Overall not all the above options, available for all the EC2 instance types. Therefore it is important to identify the EC2 Instance Types that support the required storage technologies.

Selecting EC2 Instance Type

Instance Types and Architectures

Selecting the EC2 Instance Type for a database involves identifying the CPU, Memory, Networking capabilities of the EC2 instance type in addition to the storage selection.

T2, M4 and M5

These EC2 instance families are considered as general purpose instances. In general, the lower end of general purpose instances (T2) can be used for low to medium performance databases while the high-end instances (M5) can be used for relational databases that require a balance of memory, CPU and Networking performance. These instances provide the lowest cost options for the databases.

C4, C5, R4, X1e and X1

Compute-optimized (C4, C5) instances are used for compute-intensive databases or applications that a higher degree of complex computational queries. It delivers very cost-effective high performance at a low price per compute ratio.

The highest ends of memory-optimized instances (X1, X1e) used for high-performance databases and in-memory databases (e.g. SAP HANA) while the lower end of this family (R4) can be used for databases that require cost-effective higher allocation of memory (e.g Redis, In-memory caches).

H1, D2 and I3

These EC2 instance families are considered as storage optimized. H1 instance type comes with HDD-based local storage which is suitable for databases that require high disk throughput (e.g large object databases) capabilities for lower costs. D2 instance type in comparison with H1 has similar characters but provides more storage.

I3 instance family provides Non-Volatile Memory Express (NVMe) SSD-backed Instance storage which provides significantly better I/O performance. It is suitable for NoSQL databases (e.g. Cassandra, MongoDB, Redis), in-memory databases (e.g. Aerospike), scale-out transactional databases and data warehousing. However, it is important to implement fault-tolerant architectures (e.g clustering) to improve the reliability of the database since I3 uses instance storage.