DynamoDB Connector

You can create a DynamoDB connector to connect to a DynamoDB database in Amazon AWS. This enables digital twin instances (both real-time and simulation) to retrieve saved values for their state properties and to persist updates to their state properties in corresponding digital twin instances stored in the database.

To connect to a DynamoDB database, you need to supply a set of credentials for an AWS account that has AWS permissions to create/access/modify tables and create/read/update/delete items. The AWS credentials are provided through the UI when you create a new DynamoDB connector and consist of:

  • AWS Region: the region in which the instances will be persisted.

  • AWS Access Key Id: the access key Id of the account used to access the DynamoDB table.

  • AWS Secret Access Key: the secret key associated with the account used to access the DynamoDB table.

In addition, you can supply the following parameters for the connection:

  • Update Interval: the minimum period in seconds between successive updates to a persisted instance after updates to its corresponding digital twins instance

  • Retrieve State on Create: indication whether to retrieve properties from DynamoDB when creating a digital twin instance

Note

The Update Interval parameter allows digital twin deployments with high message rates and/or many data sources to throttle their updates to the database and avoid hitting its resource limits.

Here is a screenshot of the dialog in the ScaleOut Digital Twins™ UI for creating a DynamoDB connector:

dynamodb_connector_image

You can deploy the connector immediately after it is created, or you can deploy it at a later time. The connector authenticates with AWS and the DynamoDB table when it is deployed.

Note

The instances are persisted in a table named DigitalTwinInstances in the region specified at the creation of the connector. If the table does not already exist, it will automatically get created when the connector is initialized.

Enable Persistence for a Digital Twin Model

Java Models

A Java digital twin model can enable persistence by adding enablePersistence to the model definition file and setting it to true. The model will use the default, configured persistence provider, which is the last persistence provider that was configured. If more than one persistence provider has been configured, the value persistenceProvider can be added to the model definition file and set to one of the following strings: “CosmosDB”, “DynamoDB”, “SQLServer”, “SQLite”, “AzureDigitalTwinsService”, or “Default”.

.NET Core Models

A .NET Core digital twin model can enable persistence by adding EnablePersistence to the appsettings.json and setting it to true. The model will use the default, configured persistence provider, which is the last persistence provider that was configured. If more than one persistence provider has been configured, the value PersistenceProvider can be added to the model definition file and set to one of the following strings: “CosmosDB”, “DynamoDB”, “SQLServer”, “SQLite”, “AzureDigitalTwinsService”, or “Default”.

Here is an example:

 {
     "StartupDll": "WindTurbine.dll",
     "ModelName": "WindTurbine",
     "ModelType": "WindTurbine.dll, WindTurbine.WindTurbineDigitalTwin",
     "MessageType": "WindTurbineMessages.dll, WindTurbineMessages.DeviceTelemetry",
     "EnablePersistence": true
 }

Rule-based Models

To enable persistence in a rule-based model, set the EnablePersistence property in the model definition file. This can be done directly in the ScaleOut Model Development Tool:

persistence_dev_tool