👾DynamoDB
soketi supports connecting to a DynamoDB table (global or regional) to retrieve app data. This driver is highly efficient for this purpose since no strong consistency is needed and there are two indexes that will be used (AppId
and AppKey
).
Of course, soketi requires your DynamoDB table to use a predefined schema so that soketi knows how to retrieve your app data. The following DynamoDB schema is written in Javascript, but may be translated to other formats as needed:
Inserting data into this table would look like the following:
Note that the "Webhooks" field is stored as a JSON-encoded string.
AWS has detailed documentation with many ways to define credentials for the DynamoDB client. soketi uses the same conventions, so you are free to define your AWS credentials in the .aws
folder, environment variables, or from an EC2 / ECS profile.
IAM Permissions
The IAM Policy needed to work with the DynamoDB driver must contain the following permissions:
dynamodb:GetItem
(forAppId
retrieval)dynamodb:Query
(forAppKey
retrieval)
Environment Variables
The following environment variables are used to control the behavior of the DynamoDB app driver:
Name | Default | Possible values | Description |
|
| Any string | The table to pull the app data from. |
|
| Any AWS region | The DynamoDB region the table was deployed to. For global tables, you may choose any region. |
|
| Any URL | The endpoint used to connect to DynamoDB. May be used for testing or for local DynamoDB configurations. |
Limits on an app-by-app basis
This feature is truly optional. Your items in DynamoDB can have the following new fields:
Not setting any of the above fields will ignore the setting, and will fallback to the limits associated with the server-level declared defaults.
Existing apps running on <0.29.0
will still work even if you don't have these fields added after the migration to 0.29.0
. You should add these fields to keep your database up-to-date or to have the choice to, later on, imply limits to your apps.
Last updated