DynamoDB

DynamoDB is a NoSQL, schemaless database. It functions—on the surface—in similar ways to other database-style data sources, such as Salesforce or Oracle. DynamoDB can be used for more freeform data needs within a Skuid page, and it actually allows for users to create new fields on the fly.

Note that, while DynamoDB’s schemaless structure allows for flexible data management, it is intended for data as opposed to assets. For the storage of files, consider using S3.

For more general information, see Amazon’s Getting Started with Amazon DynamoDB.

Configuration

First configure an authentication provider using your AWS security credentials. After doing so, configure a data source—choosing Amazon DynamoDB as the data source type.

AWS Access Permissions

When using AWS APIs, it is best practice to utilize strict and well-defined IAM policies so users can only perform actions they have explicit access to.

Listed below are the permissions this data source type requires to properly function. Use this list to better define your IAM roles.

  • listTables
  • describeTable
  • scan
  • query
  • putItem
  • updateItem
  • deleteItem

Using the AWS DynamoDB data source

As DynamoDB is schemaless, it has some unique concepts you’ll need to know to use it properly within Skuid.

  • Model entities for the DynamoDB data source type are based on the tables in your DynamoDB instance. Because of that, you’ll need to create at least one table before you work with Dynamo within a Skuid page.
  • Once a model entity is selected, only the indexed fields are pulled in to Skuid (namely the primary and sort key, if defined). Other non-indexed fields must be added to the model manually, in a manner similar to adding UI-only fields. The Skuid field Id should match the field name in the Dynamo table.
  • Due to this schemaless nature, it is possible to create new fields for a table on the fly in Skuid. Simply click Add Field, and set your Field ID and Custom Label.
  • Items within DynamoDB are analogous to records within relational databases

Model Properties

  • Query by Index: Determines whether the model queries against a table’s primary index or a secondary index.

    • Primary Index: (Default) The model will query against the primary, default index of the chosen DynamoDB table.

    • Secondary Indexes: Any global or local secondary indexes associated with the chosen table will be listed by name. Selecting a secondary index will cause the model to query against the chosen index, meaning a different subset of data may be returned.

      Warning

      Querying by a secondary index can have positive or negative impacts on your DynamoDB bill. Be sure to review AWS documentation on the concepts and configuration of secondary indexes.

Conditions

As DynamoDB is schemaless—and its model entities are the tables created within the DynamoDB instance—there are no default conditions. However, Skuid admins can use conditions to create filters and limit data as with any other Skuid data object:

  • Text fields can be filtered using the following operators:
    • = or equals
    • != or does not equal
    • starts with
    • contains
    • does not contain
    • does not start with
  • Number fields can be filtered using the following operators:
    • = or equals
    • != or does not equal
    • > or greater than
    • >= or greater than or equal to
    • < or less than
    • <= or less than or equal to
  • If multiple specified values are set for a condition, a field can be filtered based on whether its value is in or not in the specified set of condition values.

However, while users can filter on any field within a table, all users should be aware of DynamoDB’s query and scan behavior. To summarize, it is best practice to filter by key attributes when possible. This will use a query function rather than scanning every item in your table. If filtering by a non-key attribute is necessary, end-users should first filter by a key attribute to avoid scanning the entire table for data.

These behaviors make a difference on your DynamoDB costs, so build your Skuid pages with this in mind and instruct your end-users appropriately.

Troubleshooting

  • When trying to select a model entity, I see “An internal server error occurred.”

    The IAM user associated with your AWS access credentials within your Skuid authentication provider probably does not have the appropriate permissions for the service you are accessing. Return to the AWS console and ensure your IAM policy settings are correct.

    If your policy settings are correct, recreate your authentication provider with a new access key.

  • I do not see my secondary index available as an option for the Query by Index property.

    There may be a caching issue with your index list. Try restarting your browser or, if all else fails, clearing your browser’s local storage.