Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can not find table using NoSQL Workbench for DynamoDB when connecting to DynamoDB Docker

I've started DynamoDB in Docker:

docker run --network xxx --name dynamodb -d -p 8000:8000 amazon/dynamodb-local

I've created a table:

aws dynamodb create-table --table-name test --attribute-definitions \
AttributeName=UUID,AttributeType=S \
--key-schema AttributeName=UUID,KeyType=HASH \
--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 --endpoint-url http://localhost:8000

List the table:

aws dynamodb list-tables --endpoint-url http://localhost:8000
{
    "TableNames": [
        "test"
    ]
}

I'm able to connect to it using localhost:8000. Now I've installe NoSQL Workbench for Amazon DynamoDB. I checked operation builder and added the connection for a local dynamoDB. I've searched for tables (test) but I can not find anything? What am I doing wrong?

like image 617
DenCowboy Avatar asked Sep 10 '20 18:09

DenCowboy


People also ask

How do I add a table to DynamoDB?

In Amazon DynamoDB, you can use either the DynamoDB API, or PartiQL, a SQL-compatible query language, to add an item to a table. With the DynamoDB API, you use the PutItem operation to add an item to a table. The primary key for this table consists of Artist and SongTitle. You must specify values for these attributes.


1 Answers

The key to make it work is to use the -sharedDB flag, as detailed here.

Unfortunately, adding only that one key would cause container to exit right after start, I believe the reason is that by providing one flag it overwrites all the standard ones.

To obviate the problem I just supply all the standard ones and it works:

docker run -p 8000:8000 -d amazon/dynamodb-local -jar DynamoDBLocal.jar -sharedDb -dbPath .

With docker-compose you can do the same as follows:

version: '3'
services:
  local-dynamo:
    image: amazon/dynamodb-local
    command: -jar DynamoDBLocal.jar -sharedDb -dbPath .
    ports:
      - "8000:8000"
like image 198
Andre.IDK Avatar answered Oct 23 '22 06:10

Andre.IDK