DynamoDB: 10 tips to improve performance and lower cost

Part 2 of 3: Understanding AWS DynamoDB features and best practices.

In this article we will focus on different DynamoDB features that you can choose to better manage your data. This includes explanations of what a reserved capacity is, replicated writes, global tables, backups, integration with Kinesis, AWS Glue, DAX streams, and S3 buckets.

This is the second installment in a three-part series. To start from the beginning read the first article Understanding the basics of using DynamoDB. Or you can skip ahead to part three, 9 recommendations to minimize DynamoDB operational costs.

What is DynamoDB?

Amazon DynamoDB is a fully managed NoSQL database service that lets you offload the administrative burdens of operating and scaling a distributed database. In this three-part series, I am going to walk you through the basics of DynamoDB and show you some best practices that could save you some operational expense while using this Amazon service.

Knowing what you're paying for means understanding your options

This involves knowing the capabilities and functions of the following and how they impact the cost of running DynamoDB.

1. Reserved capacity

With reserved capacity, you pay a one-time upfront fee and commit to a minimum provisioned usage level over a period of time. Your reserved capacity is billed at the hourly reserved capacity rate.

2. Replicated writes

When using DynamoDB global tables, your data is written automatically to multiple AWS regions of your choice. Each write occurs in the local region as well as the replicated regions.

3. Backups: Point-in-time recovery and on-demand backup

  • Point-in-time recovery (PITR) based backup works based on the size of each DynamoDB table on which it is enabled. DynamoDB monitors the table size continuously throughout the month to determine your backup charges and continues to bill you until you disable PITR on each table.
  • On-demand backups work based on the storage size of the table. The size of the backup is determined at the time of each backup request. The sum of all backups of the DynamoDB table will be the cost of the backup.

4. Global tables

When using the latest version of global tables, you must either use on-demand capacity or enable auto-scaling on the table. Using auto-scaling or on-demand capacity ensures that you always have sufficient capacity to perform replicated writes to all regions of the global table. The number of replicated write capacity units (rWCUs) or replicated write request units will be equal in all Regions of the global table.

5. Change data capture for Kinesis Streams

DynamoDB charges for change data capture for Amazon Kinesis Data Streams in change data capture units. DynamoDB charges one change data capture unit for each write (up to 1 KB). You pay for the writes your application performs without having to manage throughput capacity on the table.

6. Change data capture for Glue Elastic Views

DynamoDB charges for change data capture for AWS Glue Elastic Views in change data capture units. DynamoDB charges one change data capture unit for each write (up to 1 KB). You pay for the writes your application performs without having to manage throughput capacity on your table.

Note: AWS Glue Elastic Views charges still apply when you replicate DynamoDB changes to an AWS Glue Elastic Views target database.

7. Data export to S3 buckets

The data export feature is used to export data from your DynamoDB continuous backups (point-in-time recovery) to Amazon S3. The supported output data formats are DynamoDB JSON and Amazon Ion.

DynamoDB charges for data you export based on the size of each DynamoDB table (table data and local secondary indexes) at the specified point in time when the backup was created. Additional charges apply for storing exported data in Amazon S3 and for PUT requests made against your Amazon S3 bucket.

8. DAX cost

Pricing is per node hour and dependent on the size of the node.

9. DynamoDB streams

DynamoDB charges for reading data from DynamoDB Streams in read request units. Each GetRecords API call is billed as a streams read request unit and returns up to 1 MB of data from DynamoDB Streams.

Streams read request units are unique from read requests on your DynamoDB table. You are not charged for GetRecords API calls invoked by AWS Lambda as part of DynamoDB triggers. You also are not charged for GetRecords API calls invoked by DynamoDB global tables.

10. Data transfer

Data transfer in and out refer to transfer into and out of DynamoDB. DynamoDB does not charge for inbound data transfer, and it does not charge for data transferred between DynamoDB and other AWS services within the same AWS Region.

Data transferred across AWS regions (such as between DynamoDB in the US East [N. Virginia] Region and Amazon EC2 in the EU [Ireland] Region) is charged on both sides of the transfer.

Note: As part of the AWS Free Tier, you receive 1 GB of free data transfer out each month, aggregated across all AWS services except in the AWS GovCloud.

Practical DynamoDB choices with optimal outcomes

By understanding these options and best practices, users can effectively optimize the performance and cost of running DynamoDB, ensuring efficient data management and scalability for their applications. 

Srivatssan Srinivasan, Director, Enterprise Architect, Card Tech–Canada

Srivatssan “Sri” Srinivasan is currently fulfilling the role of an Enterprise Architect at Capital one. During his career, he has developed a deep understanding of business processes in the Insurance, E-Commerce and Financial domains. During free time, Sri loves to read books on psychology, personal development, leadership training and has a special interest in the field of cognitive psychology. Sri is also an advocate in developing modern microservice-based event-driven distributed applications.

Explore #LifeAtCapitalOne

Startup-like innovation with Fortune 100 capabilities.

Learn more

Related Content