AWS Cloud Database Options

Introduction

In this article, we will go through the database overview and considerations first. Secondly, we will learn Amazon relational database services (RDS) and Amazon DynamoDB. Finally, we will learn how to choose a database service.

Database Overview and Considerations

In the past, we just used SQL as our databases. However, in recent years, NoSQL database has become increasingly popular. Compared with SQL, NoSQL adopts key-value pairs instead of rows and columns. Moreover, we are able to add new field when and where using NoSQL. That means the schemas of NoSQL is much more flexible than SQL.

When we talk about the use case, SQL is suitable for online analytical processing while NoSQL suitable for online transaction processing. Another way to decide to use SQL or NoSQL is to see whether we need to join our tables or not, if yes than choose SQL. We should analyze our data requirements by considering the data formats, data size, query frequency, data access speed and data retention period.

Amazon Relational Database Service (RDS)

Amazon RDS is a cost-efficient and resizable capacity database. It manages time-consuming database administration tasks. Also, it is fully capable with Aurora, MySQL, MariaDB, SQL server, Oracle and PostgreSQL.

There are some benefits to use RDS:

  1. Simple and fast to deploy and scale
  2. Manages common database administrative tasks
  3. Compatible with our applications
  4. Fast, predictable performance
  5. Secure
  6. Cost-effective

RDS is nothing but just a DB instance. it is an isolated database environment in the cloud. We can do automatic backup or manual snapshots. For snapshots, it could be cross-region and stored on S3.

Instead of single AZ, we can use Multi-AZ RDS when we setup the database. With this approach, the database is synchronously replicated to another AZ in the same region. Also, it will failover to the standby RDS automatically.

Amazon DynamoDB

Amazon DynamoDB allows us to store any amount of data with no limits. Also, it provides fast, predictable performance using SSD. It allows us to easily provision and change the request capacity needed for each table. More importantly, it is a fully managed, NoSQL database service.

DynamoDB maintains a sorted index for both keys.

We specify how much provisioned throughput capacity we need for reads and writes. Then DynamoDB will allocate the necessary machine resources to meet our needs.

Furthermore, we can do query and scan in DynamoDB. We can query a table using the partition key and an optional sort key filter. If the table has a secondary index, query using its key. It is the most efficient way to retrieve items from a table or secondary index.

Also, we can scan a table or secondary index but it is slower than querying because scan reads every item.

We are able to use conditional expressions in both query and scan.

Above shows an example to use DynamoDB.

RDS vs DynamoDB

Below table summarizes what we have discussed in this article. No matter RDS or DynamoDB, they have their own advantages and disadvantages.

Therefore, we have to know our needs to decide what database we should use. In fact, if we have no preference in between RDS and DynamoDB, we can just use EC2 to build our own database.

Conclusion

In AWS, we can even outsource our database service. But be friendly reminded that RDS is not fully managed by AWS while DynamoDB is full managed service.

Leave a Reply