Amazon DynamoDB Persistence

Sami Salonen edited this page Oct 12, 2016 · 12 revisions


This service allows you to persist state updates using the Amazon DynamoDB database. Also query functionality is fully supported. Users are recommended to familiarize with AWS Pricing before using this plugin.

This plugin was first introduced in openHAB 1.9.0.



  • Writing/reading information to relational database systems.
  • Database Table Name configurable
  • Automatic creation of tables


  1. Set-up Amazon account as described below (see Setting up Amazon account)
  2. For installation of this persistence bundle, please follow the same steps as if you would install a binding.
  3. Place a persistence file called dynamodb.persist in the ${openhab.home}/configuration/persistence folder. This has the standard format as described in Persistence.
  4. Configure openhab.cfg (see Openhab configuration below)

Setting up Amazon account

  1. Sign up for Amazon AWS
  2. Select the AWS region in the AWS console using these instructions. Note the region identifier in the url (e.g. means that region id is eu-west-1)
  3. Create user for openhab with IAM
  4. Open Services -> IAM -> Users -> Create new Users. Enter openhab to User names, keep Generate an access key for each user checked, and finally click Create.
  5. Show User Security Credentials and record the keys displayed
  6. Configure user policy to have access for dynamodb
  7. Open Services -> IAM -> Policies
  8. Check AmazonDynamoDBFullAccess and click Policy actions -> Attach
  9. Check the user created in step 2 and click Attach policy

Openhab configuration

Basic configuration

Configure addon using openhab.cfg, for example


The accessKey and secretKey correspond to credentials shown in IAM when creating the AWS user. Region needs to match the region what was used to create the user.

Alternative configuration using credentials file

Alternatively, instead of specifying accessKey, secretKey, one can configure profilesConfigFile (path to Amazon credentials file) and profile (name of profile to use). For example,


Example of credentials file (/home/openhab/aws_creds):


Please note that the user that runs openhab must have approriate read rights to the credential file. For more details on the Amazon credential file format, see Amazon documentation.

Advanced configuration

Other configuration parameters for the dynamodb addon:

  • readCapacityUnits, read capacity for the created tables. Defaults to 1.
  • writeCapacityUnits, write capacity for the created tables. Defaults to 1.
  • tablePrefix, table prefix used in the name of created tables. Defaults to openhab-.

Refer to amazon documentation on provisioned throughput on details on read/write capacity.


Tables created by the addon

When item is persisted via this addon, a table is created if necessary. Currently the addon will create at most two tables for different item types. The tables will be named <PREFIX><ITEMTYPE>, where <PREFIX> matches the tablePrefix configuration; while the <ITEMTYPE> is either bigdecimal (numeric items) or string (string and complex items).

Each table will have three columns: itemname (item name), timeutc (in ISO 8601 format with millisecond accuracy), and itemstate (either number or string representing item state).


  • When the tables are created, the read/write capacity is configured according to configuration. However, the addon does not modify the capacity of existing tables. As a workaround you can modify the read/write capacity of existing tables using Amazon console.


Please note that there might be charges from Amazon when using this addon to query/store data to DynamoDB. See Amazon DynamoDB pricing pages for more details. Please also note possible Free Tier benefits.


This addon is provided "AS IS", and the user takes full responsibility of any charges, damage to amazon data.

feature overview


Setup intro

Linux and OS X





User Interfaces



(link to openHAB forum)



Application Integration



A good source of inspiration and tips from users gathered over the years. Be aware that things may have changed since they were written and some examples might not work correctly.

Please update the wiki if you do come across any out of date information.

Binding configurations

Use case examples

Item definition examples

Sitemap definition examples

Collections of Rules on a single page

Single Rules


Syntax highlighting for external editors

Release Notes

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.