Intro to DynamoDB

DynamoDB is Amazon’s fully managed, serverless, NoSQL database service. It’s built to deliver single-digit millisecond performance at any scale — from a side project with a few users to a global app with millions of requests per second. That’s a lot in a couple of sentences, so let’s break it down a bit:

Fully Managed & Serverless
Forget about provisioning infrastructure, patching, or maintenance windows. You simply create a table and start storing data.

NoSQL Flexibility
DynamoDB supports key-value and document data models. This schema-less design means that you can easily evolve your app over time.

Millisecond Latency
Consistently fast reads and writes — perfect for user-facing applications where speed matters.

Additional Benefits of DynamoDB

High Availability by Default
Your data is replicated across multiple data centers (availability zones) automatically.

Instantly Scalable
It automatically scales up and down to match your workload. You focus on building — DynamoDB handles the heavy lifting.

Secure by Design
Integration with AWS IAM lets you control who can read or write your data.

How is Data Stored?

You store your data in tables. Each table holds items (think rows), and each item has attributes (think columns). The benefit of NoSQL is that the attributes are flexible, meaning you can add or remove attributes later, making it more flexible for the future.

Primary Keys & Sort Keys

DynamoDB doesn’t do fancy SQL joins — instead, it’s all about key design. When you create a table, you define its Primary Key. There are two ways to do this:

  • Simple Primary Key (Partition Key Only)
    One attribute uniquely identifies each item — for example, UserID.
  • Composite Primary Key (Partition Key + Sort Key)
    Here’s where it gets interesting. You combine a Partition Key (PK) with a Sort Key (SK). The PK decides which partition your data lives in, and the SK lets you store multiple related items under the same PK, sorted however you want.

Example:
Imagine an Orders table:

  • Partition Key: CustomerID
  • Sort Key: OrderDate

One customer can place lots of orders — same PK (CustomerID), different SK (OrderDate). This makes it easy to pull up a customer’s order history sorted by time.

Capacity Options

DynamoDB gives you two ways to handle capacity that you must determine when you create your table.

  • Provisioned Capacity: You set how much read and write throughput you want. Good for predictable workloads.
  • On-Demand Capacity: DynamoDB automatically adjusts throughput as your traffic changes. Perfect for unpredictable spikes.

Supercharge with DAX

Got read-heavy workloads that need to be lightning fast? DynamoDB has DAX (DynamoDB Accelerator) — an in-memory cache that drops read latency to microseconds. It’s fully managed and works with your existing DynamoDB API calls. No big rewrites required because it uses the same interface as DynamoDB.

DynamoDB Streams

DynamoDB can do more than just store data — it can stream changes as they happen.

Turn on Streams, and you get a real-time feed of all inserts, updates, and deletes in your table. Hook this up to AWS Lambda or Kinesis, and boom — you have an event-driven architecture that reacts instantly when your data changes, like sending notifications when a profile is updated, syncing data to other services, or keeping audit logs

Go Global with Global Tables

If your users are all over the planet, DynamoDB’s Global Tables replicate your data across multiple AWS Regions automatically. Low latency, multi-region resilience, and active-active writes — no extra infrastructure needed.

Should You Use DynamoDB?

If you’re looking for a NoSQL database that has fast, consistent performance, easy to manage and highly available, DynamoDB is a great option.

If your data would require advanced queries or aggregated data, or you have records over 400KB (exceeds DynamoDB data limit), then you may need to stick to a relational DB.

Next Steps

In the next post, we will build our first DynamoDB table and deploy it using AWS CDK.

Until then, Happy Coding!

Yahtzee with ReactJS

If you’ve been following my blog, its no secret that I like games. And while it is my goal to create something more exciting than a basic board game, I wanted to keep things simple for this project to try some new things out.

For those that don’t wish to read further, you can play the game here! I haven’t added any instructions yet, so if you aren’t familiar with Yahtzee, you might want to brush up on how to play before you dive in.

When I started this project I had a few goals in mind: ReactJS practice, utilize styled components, explore react context for state management. As I was getting closer to completion, I had some roadblocks that shifted what I wanted to learn, and the actual outcomes were much different than I intended.

State Management
Initially, I just used local state on the game component to keep track of everything and passed props where I needed to. This was good for my first iteration, but I knew it wasn’t going to be a final solution. Anytime there is a change in state, the entire tree rendered. This meant that when I clicked a die to lock it in, everything on the page would re-render, even though the only thing that changed was the die. To solve this, I decided to add redux. On a previous project, I was introduced to redux and it was complicated and intimidating. So naturally for this project, I wanted to explore other state options. After looking into it though, redux made sense for this project. Being a bit more simplistic application (and making sure I used the redux toolkit), it was a bit easier to understand how the pieces were working. I do not think I would have used this if the toolkit was not available.

Styles
I decided to add Material UI to my project so that didn’t have to manually style everything. I wanted to deliver the MVP in a way that was presentable, but mainly focus on the functionality. For some of the components that would need a touch up, I found that you could used styled component syntax. This was great, as I was hoping to do some CSS in JS practice and I was curious how this would work. After getting everything wired up, I played a few games and noticed performance issues. It took a bit of tracking down, because the application wasn’t that complicated. After eliminated refresh issues and running timers on my roll dice calculations, I found an issue in MUI v4 around styled components. Needless to say, I tore all of it out and just used stylesheets.

Possible Next Steps:
I would like to enhance this project with some multiplayer, much like I did with Connect 4. Hopefully this will help make it a bit more exciting for people to get into. It would also be useful to add some How to play instructions for beginner users and also add the Yahtzee Bonus category into the game, as it is in the real version of the game. I also would like to explore updating the UI and making it more responsive for mobile/desktop. Right now, its really mobile first, and the experience is ok for both environments, but could be improved.

Getting Started in IoT: Part 3

In the final part of this IoT series, we will connect our light switch to a CloudMQTT broker. Then we will make an iOS app using Xamarin, and a web application with Blazor that connect to the cloud and send/receive messages so that we can control our light switch over the internet.

Resources:
iOS App/Web App code
Arduino code
Mqtt Documentation
PubsubClient Documentation (Arduino Library)
MqttNet Examples (C# Library)

Where to go from here
This series was an intro to IoT and while turning an LED bulb on and off isn’t that useful on its own, it laid the groundwork for applications that do more exciting things. One goal for the year for me is to make an IoT cat feeder that will automate feeding and give alerts when the food is running low. Other examples that you could try could be an app to control your garage door, weather station monitor, or home automation system.

Getting Started in IoT: Part 2

After a bit of a break with the holidays, it’s time to pick back up on part 2 of the IoT series. In this video, we’ll take a look at how to wire up the button and start to push code to our microcontroller so that we can keep state of the light being on and off.

Here is the link to the code that I uploaded to the board.

In our final segment, we will wrap up by communicating with a message broker so that we can publish/subscribe updates from our microcontroller and make a mobile application that will communicate via the internet to control the light.

Design a site like this with WordPress.com
Get started