由于代理错误,Dynamodb localhost:8000 连接失败

Dynamodb localhost:8000 connection failing due to proxy error

我可以使用此命令在本地启动 Dynamodb -

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

我收到对上述命令的以下响应-

    Initializing DynamoDB Local with the following configuration:
Port:   8000
InMemory:       false
DbPath: null
SharedDb:       true
shouldDelayTransientStatuses:   false
CorsParams:     *

但是,当我在 AWS CLI 上输入以下命令来设置本地端点时-

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

我低于错误-

  An error occurred (504) when calling the ListTables operation (reached max retries: 9): <HTML>
    <HEAD><TITLE>The Proxy Was Unable to Fulfill Your Request</TITLE></HEAD>
    <BODY>
    <H1>The Proxy Was Unable to Fulfill Your Request</H1>
    <HR SIZE="1">
    <P>The proxy was unable to fulfill your request because it could not contact the computer at localhost:8000 (Connection reset by peer).</P>
    <P>The website may be temporarily unavailable. If later attempts to access this website are still unsuccessful, you may wish to contact the website's adminis
    tor.
    </P>
<HR SIZE="1">
</BODY>
</HTML>

我的 PC 的本机代理设置为绕过本地地址,包括 localhost。我也尝试使用 CLI 设置 AWS HTTP 和 HTTPS 代理。但它没有用。然后我尝试使用 AWS Eclipse 插件并使用它,我可以连接到本地主机上的 dynamodb(仅通过 Eclipse,而不是从 CLI)。我希望能够使用 CLI 来处理本地 dynamodb。

请帮忙

谢谢, 库纳尔

如果您想查看 table 列表,请在 http://localhost:8000/shell/

上执行以下脚本
var dynamodb = new AWS.DynamoDB({
    region: 'us-east-1',
    endpoint: "http://localhost:8000"
});

var params = {
};

function doPrint(response) {
    if (response.error) ppJson(response.error); // an error occurred
    else {
        ppJson(response.data); // successful response
    }
}


console.log("List of tables");
dynamodb.listTables(params)
    .on('complete', doPrint)
    .send();

我通过添加以下 Windows 环境变量解决了这个问题-

HTTP_PROXY = http://<My-Proxy-Host>:<My-Proxy-Port>
HTTPS_PROXY = http://<My-Proxy-Host>:<My-Proxy-Port>
NO_PROXY= localhost

重新启动 PC 以反映这些设置很重要。

希望对有需要的人有所帮助。