Ensuring DynamoDB localhost uses the correct region

I’ve been using dynamoDB running on localhost to code with.  I was having a problem where the region was being set (default us-east-1), which was hiding my tables and data :O(

I could see a file “**_us-east-1.db” being created.

After some rummaging (what a lovely word … :D ), I fixed things:


  private DynamoDB getDynamoDBClient() {
        AmazonDynamoDBClient client = new AmazonDynamoDBClient()
                .withEndpoint("http://localhost:8000");
        /**
         * set the region to local
         *
         * avoid getting default regions on localhost:
         *      aws_key_us-east-1.db
         *
         * you will see:
         *      aws_key_local.db
         */

        client.setSignerRegionOverride("local");
        return new DynamoDB(client);
    }

Set the client.setSignerRegionOverride("local"); to local.

This will give you a local dynamoDB file “_local.db”, ending in local.db.

The Github Gist is here.

Author | Miles Davenport

Career programmer, who designs, assembles, fixes, and supports customers, software and systems.