View a markdown version of this page

Map classes to DynamoDB items by using the DynamoDB Mapper - AWS SDK for Kotlin

Map classes to DynamoDB items by using the DynamoDB Mapper

DynamoDB Mapper is a high-level library that maps your Kotlin classes to Amazon DynamoDB tables and indexes, similar to the AWS SDK for Java’s DynamoDB Enhanced Client or the AWS SDK for .NET’s Object Persistence Model.

You define schemas that describe your data objects and how to convert them to DynamoDB items. After you define a schema, DynamoDB Mapper provides an intuitive, idiomatic Kotlin interface to use your objects in create, read, update, and delete (CRUD) operations on your tables and indexes.

DynamoDB Mapper supports the following:

  • Single-item operations on a table, such as deleteItem, getItem, putItem, queryPaginated, scanPaginated, and updateItem, invoked with a coroutine-friendly DSL.

  • Batch operations (batchGetItem and batchWriteItem) that read or write many items, across one or more tables, in a single call.

  • Transactional operations (transactGetItems and transactWriteItems) that read or write across multiple tables atomically.

  • Two ways to define schemas: generate them automatically from annotated classes at build time, or define them manually in code for full control.

  • Idiomatic Kotlin: suspending operations, Flow-based pagination, and DSLs for keys, filter expressions, and update expressions.

DynamoDB Mapper uses the SDK’s low-level DynamoDbClient for its underlying calls to the service.