Building Serverless applications isn’t very different from building traditional software. We need all the same pieces of the software stack: The UI, API, and Database. Previously, we talked about the serverless technology used to build the API. Now we are going to take a look at the most common serverless technology used as a Database: DynamoDB.
What is DynamoDB?
DynamoDB is an Amazon service that provides a managed NoSQL database. That’s a nice concise definition, but what does all that jargon actually mean?
Managed services are ones where we don’t have to worry about the underlying infrastructure. In other words, they are serverless as far as we are concerned. We interact with them through an API, and it’s the job of the provider to handle scaling to meet our traffic needs.
A NoSQL database is one that isn’t structured like a traditional SQL database. NoSQL doesn’t mean “Not SQL”, though, it means “Not Only SQL”. This is because you can still use a Structured Query Language to access the data in a NoSQL database. In the case of DynamoDB, the data can be stored either as a document model, or as a key-value model.
I always recommend DynamoDB as a first choice for new applications. Why? Because it’s fast, scalable, fully managed, and very affordable.
It’s easy to put any data into Dynamo without worrying about the exact schema before you finalize the design. And since it’s included in the AWS Free Tier, it’s completely free to start using until you get a solid customer base.
NoSQL lends itself very well to the Serverless ecosystem, but sometimes working with structured SQL tables is a better fit for our application. Is there a Serverless SQL solution? Why, yes, there certainly is!
Amazon Aurora Serverless is a new version of the Aurora SQL database that AWS previously offered. It will automatically scale the Aurora database to meet your needs. The SQL structure is fully compatible with MySQL, which makes it easy for most developers to just pick up and use.
At the time of writing it’s still a very young service, but it fills a valuable gap in the serverless ecosystem. If you are building an application that would be significantly more performant using a SQL database, you no longer have to manage your own services and can stay 100% serverless.
Most applications need a permanent data storage solution and serverless is no different. Amazon provides 2 viable options that will work for either SQL or NoSQL data sets. There are other options available if you choose not to use AWS that are just as viable too. Don’t let your database be the only part of your stack that isn’t serverless!