简体   繁体   English

无法通过 AWS CLI 连接到本地 DynamoDb 实例

[英]Can't connect to local DynamoDb instance via AWS CLI

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.我已经通过接下来的步骤创建了 DynamoDb 的本地实例:在 Visual Studio 中,我安装了 AWS 资源管理器并在 localhost:82 上创建了一个新的本地实例。 I can successfully work with it from my c# code using AWS library.我可以使用 AWS 库从我的 c# 代码成功使用它。 I created the table and even put into it some data.我创建了表格,甚至将一些数据放入其中。 I can even see that data in AWS explorer in Visual Studio.我什至可以在 Visual Studio 的 AWS 资源管理器中看到这些数据。 I need to add a lot of data, and I prepare to use AWS CLI tool.我需要添加大量数据,我准备使用 AWS CLI 工具。 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.但我很确定那个端口上的 DB 有一些数据,因为我可以从我的 c# 代码中实现它。 I tried to launch DynamoDb from console by this command as well:我也尝试通过此命令从控制台启动 DynamoDb:

java -jar DynamoDBLocal.jar

It successfully launched but in that case, I can't achieve this server from my c# code.它成功启动,但在这种情况下,我无法从我的 c# 代码实现此服务器。

Code from screenshot below works well and successfully put data into the table:下面屏幕截图中的代码运行良好并成功将数据放入表中: 在此处输入图片说明 On another hand, this is output from AWS CLI:另一方面,这是 AWS CLI 的输出: 在此处输入图片说明 Sorry, probably that's dumb questions, but what am I doing wrong ?抱歉,这可能是愚蠢的问题,但我做错了什么? Thanks.谢谢。

I had the exact same problem.我有同样的问题。 Basically you need to specify -sharedDb when starting up dynamo基本上你需要在启动 dynamo 时指定 -sharedDb

java -jar DynamoDBLocal.jar -sharedDb

I hope that solves your problem.我希望这能解决你的问题。

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

已经解决了类似的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM