AWS Developer Tools Blog

Configuring DynamoDB Tables for Development and Production

The Object Persistence Model API in the SDK uses annotated classes to tell the SDK which table to store objects in. For example, the DyanmoDBTable attribute on the Users class below tells the SDK to store instances of the Users class into the “Users” table.

public class Users
    public string Id { get; set; }

    public string FirstName { get; set; }

    public string LastName { get; set; }

A common scenario is to have a different set of tables for production and development. To handle this scenario, the SDK supports setting a prefix in the application’s app.config file with the AWS.DynamoDBContext.TableNamePrefix app setting. This app.config file indicates that all the tables used by the Object Persistence Model should have the “Dev_” prefix.

  <add key="AWSRegion" value="us-west-2" />
  <add key="AWS.DynamoDBContext.TableNamePrefix" value="Dev_"/>

The prefix can also be modified at run time by setting either the global property AWSConfigs.DynamoDBContextTableNamePrefix or the TableNamePrefix property for the DynamoDBContextConfig used to store the objects.