DynamoDB

Integration published by Jovo | 24,499 downloads

Store user data in a DynamoDB database on AWS

Amazon DynamoDB Database Integration

Learn how to store user specific data of your Alexa Skills and Google Actions to AWS DynamoDB.

Tutorial: Add DynamoDB to Store User Data

Introduction

The DynamoDB integration allows you to store user session data in the NoSQL service running on AWS. This integration is especially convenient if you're running your voice app on AWS Lambda. You can find the official documentation about DynamoDB here: aws.amazon.com/dynamodb.

Learn more about hosting your application on AWS Lambda.

Configuration

Download the package like this:

DynamoDB can be enabled in the src/app.js file like this:

If you're running your code on Lambda, you can simply integrate a DynamoDB table like this in your config.js file:

In case you're hosting your voice app somewhere else, you need to additionally add AWS config:

You can find a detailed guide by Amazon about setting up your DynamoDB for programmatic access here (In case you're hosting your voice app somewhere else): Setting Up DynamoDB (Web Service).

Once the configuration is done, the DynamoDB database integration will create a DynamoDB table on the first read/write attempt (might take some seconds). No need for you to create the table.

Global secondary indexes

You have the option to add global secondary indexes(GSI) to your DynamoDB table based on the user data. This gives you more flexibility on data access requirements for your user table.

Without GSI, Jovo will create records with two keys in DynamoDB, userId and userData. Example:

If you want to query your user data based on other properties, you can't without GSIs.

When you configure DynamoDB to use GSI, Jovo behind the scenes will project keys you've specified to the root level. This will allow you to perform DynamoDB queries based on properties inside user data.

GSIs configuration example:

The above configuration will project userData.data.yourKey to the root level of the record. Using the example data above, it will transform the data to look something like this:

You can now peform DynamoDB queries based on 'yourKey'.

Provisioned throughput

You can specify the provisioned throughput of your DynamoDB table.

By default if you don't provide a provisioned throughput configuration, Jovo will apply the following to the DynamoDB table and to each global secondary index:

Troubleshooting

Here are a few things you need to consider when switching from a different database to DynamoDB:

  • DynamoDB does not allow empty strings ("") as values: If you use them, please switch to null or a different value

DynamoDB Changelog

Current version might be higher than the latest changes displayed below because of updates of dependencies.

3.0.16 (2020-05-21)

💅 Enhancements

3.0.11 (2020-04-06)

  • Updated Typescript to 3.8.x
  • Updated Prettier to 2.x

Committers: 2

2.x

Find the 2.x changelog here.

Join Our Newsletter

Be the first to get our free tutorials, courses, and other resources for voice app developers.