3
votes

I've created the local instance of DynamoDb by next steps: in Visual Studio I installed AWS explorer and create a new local instance on localhost:82. I can successfully work with it from my c# code using AWS library. I created the table and even put into it some data. I can even see that data in AWS explorer in Visual Studio. I need to add a lot of data, and I prepare to use AWS CLI tool. But I can't see any data and tables from the console. I put this :

aws dynamodb list-tables --endpoint-url http://localhost:82

and see in response that:

{
    "TableNames": []
}

But I am pretty sure that DB on that port has some data because I can achieve it from my c# code. I tried to launch DynamoDb from console by this command as well:

java -jar DynamoDBLocal.jar

It successfully launched but in that case, I can't achieve this server from my c# code.

Code from screenshot below works well and successfully put data into the table: enter image description here On another hand, this is output from AWS CLI: enter image description here Sorry, probably that's dumb questions, but what am I doing wrong ? Thanks.

2
I think you would be getting error messages if it couldn't connect, instead of an empty table list. What happens when you run that command and don't have DynamoDB running at all?Mark B
Most likely you created your tables using the default endpoint instead of your local DB.helloV
@MarkB I don't see error message. I even can create table from CLI and after that I will see it in list. So that's mean that it's another server with another tablekkost
@helloV where you think I creating with wrong endpoint ?kkost
Are you using the same access key when connecting in C# and in the CLI? The access key is used as the name of the database file on disk. (The secret key is ignored and its value does not matter.) I believe if the access keys are different you will be using a different database (and not see the same tables).jzonthemtn

2 Answers

3
votes

I had the exact same problem. Basically you need to specify -sharedDb when starting up dynamo

java -jar DynamoDBLocal.jar -sharedDb

I hope that solves your problem.

2
votes
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb

has resolved a similar problem.