Saying hello to DynamoDB, Cognito, and Serverless

So since I've started dually learning some serverless application development using this awesome guide. I was able to skip through quite a few but they’re starting off with DynamoDB, which is awesome… because I’ve not used them before 😀 so I'm excited to see how it compares to the likes of MongoDB (Which I'll caveat with — been a while since I used that daily too).

What is Dynamo DB?

Amazon DynamoDB is a fast and flexible NoSQL database service for all applications that need consistent, single-digit millisecond latency at any scale. Its flexible data model and reliable performance make it a great fit for mobile, web, gaming, ad-tech, IoT, and many other applications.

I mean sure, you can pull out the facts from that elevator pitch but I’m a simple man, I like things said simply.

Paraphrasing it and which I might add, is a great primer so far. They say…

DynamoDB is a hosted NoSQL database offered by Amazon Web Services (AWS). It offers:

  • reliable performance even as it scales;
  • a managed experience, so you won’t be SSH-ing into servers to upgrade the crypto libraries;
  • a small, simple API allowing for simple key-value access as well as more advanced query patterns.

Show me the money

This year Amazon saw unprecedented traffic, maybe because we’re all stuck indoors avoiding COVID-19… but equally because they’ve made it so damn easy (too easy perhaps).

TL;DR — Over the course of the 66-hour Prime Day, things like Alexa and made 16.4 trillion calls to the DynamoDB API, peaking at 80.1 million requests per second.

That’s pretty damn impressive… a lot of that performance will come from two things to me.

  • It scales so well and they can scale as much as they want — they own it
  • They used it for the right things, one of the use cases was ‘Data sets with simple, known access patterns.’ in this case recommendations to users.

This is not a how-to, this is going to be an experiences log

Setting up the DynamoDB

Following this guide from here, this was all pretty simple. Following the guide I went a read a little from this site also :

I’ll admit I’ve skimmed this but it's simple enough.

Setting up Cognito

Cognito is going to be my identity equivalent, a user authentication. Just using it on a simple example I can already tell I’ll like this.

Amazon Cognito lets you add user sign-up, sign-in, and access control to your web and mobile apps quickly and easily. Amazon Cognito scales to millions of users and supports sign-in with social identity providers, such as Facebook, Google, and Amazon, and enterprise identity providers via SAML 2.0.

Makes me wonder why I’d never heard of it before, typically the likes of had made it into my list of managed auth but not this. They feel similar so far.

Disclaimer: To date, I’ve only set up a user pool and created a user via the CLI.

Setup Serverless and added one endpoint

A couple of deviations from the tutorial here:

As a note for the future, be careful with serverless and profiles… it can trip you up if you miss that part about making sure you define it as AWS_PROFILE . Also never assume you didn’t make a mistake copy-pasting it, I certainly did, that was 30 minutes of confusion I’ll never get back.

Wrapping up here… next is to flesh out more of the API and hopefully deploy it.

Fullish-stack engineer ( and Lead front-end engineer @Pushdoctor with 15+ years developing web apps, installations, AR toys and other fun stuff.