Amazon DynamoDB For The .NET Developer

This blog post is a collection of other posts that covers various aspects of Amazon DynamoDB and other services you can integrate with when building serverless applications.

Rahul Pulikkot Nath
Rahul Pulikkot Nath

Table of Contents

This article is sponsored by AWS and is part of my AWS Series.

DynamoDB is a cloud-hosted NoSQL database provided by Amazon Web Services (AWS). DynamoDB provides reliable performance, a managed experience, and a convenient API access to interact with it.

This blog post is a collection of other posts that covers various aspects of Amazon DynamoDB and other services you can integrate with when building serverless applications.

Getting Started With Amazon DynamoDB

If you are completely new to AWS DynamoDB and just getting started, check out my getting started article below.

AWS DynamoDB For The .NET Developer: How To Easily Get Started
Learn how to get started with AWS DynamoDB with .NET Core by updating the default ASP NET Web API template to use DynamoDB as it’s data store. We will learn to do basic Creat, Read, Update and Delete operations from the API.

It covers an introduction to DynamoDB, an understanding of how to create tables, and doing basic Create Read, Update, and Delete (CRUD) operations from the .NET application using the DynamoDB SDK.

Running DynamoDB on Your Dev Machine

DynamoDB Local is available as a download that is useful for developing and test applications without accessing the DynamoDB Web Service. The database is self-contained and runs on your computer.

How to Run and Access DynamoDB Local For Easy Development and Testing
Learn how to set up and run DynamoDB database on your local development machine. We’ll see how to connect using AWS CLI, from .NET application and using GUI tools like Dynobase and NoSQL Workbench.

Check out the above article, where I walk through in detail how to set up a local instance of DynamoDB, access it from applications, and the different modes it supports. I also cover the various GUI tools that can interact with the locally installed database instance.

Retrieving Data From DynamoDB

To retrieve data from DynamoDB, you have multiple querying options.

The Query operation is ideal for retrieving items that match specific criteria using partition and sort key values. Another option is the Scan operation, which filters results based on conditions but can be costly and impact performance for large tables.

As a rule of thumb, when querying data, you can consider that each record that you retrieve from the database has a direct cost attached to it. Limiting the items you retrieve has a direct impact on saving cost and also performance. Pagination helps with breaking down the items into smaller groups and loading them as required.

To learn more about different ways you can query DynamoDB and how to paginate data in your requests, check out the posts below.

Improving Query Performance Using Indexes in DynamoDB

Amazon DynamoDB provides fast access to items in a table by specifying primary key values.

However, applications often require accessing data using alternate keys as well. In these cases, defining a second set of keys, a Secondary Index, is advantageous and beneficial to enable data access.

Writing Data To DynamoDB

DynamoDB provides two primary methods to write/modify data in a table: PutItem and UpdateItem. These are part of the Low-Level API IAmazonDynamoDB. The High-Level API, IDynamoDBContext wraps the two methods into a single SaveAsync method.

By default, when using the .NET DynamoDB SDK, it serializes .NET classes, with a default constructor, as JSON objects. However, you can customize the data written into DynamoDB using Custom Converters.

When writing data to DynamoDB, it is essential to ensure data consistency when multiple users or applications access the same data simultaneously. Check out the below articles to explore the different ways you can ensure data consistency when writing to DynamoDB.

DynamoDB and AWS Lambda

DynamoDB Triggers allow you to automatically invoke a Lambda function in response to specific actions on a DynamoDB table, such as item updates, inserts, or deletions.

DynamoDB Triggers enable you to build powerful and scalable applications that can automatically respond to changes in your DynamoDB tables without the need for any polling or manual intervention.

Check out the below articles to understand more about DynamoDB and AWS Lambda Triggers.

I hope this helps you get a good understanding of Amazon DynamoDB, and how to read/write to tables and integrate it with other AWS Services from your .NET application.