Search code examples
localhostamazon-dynamodbhttp-proxy

Dynamodb localhost:8000 connection failing due to proxy error


I am able to start Dynamodb locally using this command-

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

I get following response to the above command-

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

However, when I enter below command on AWS CLI to set local endpoint-

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

I am getting below error-

  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>

MY PC's native proxy is set up to bypass local addresses including localhost. I tried setting AWS HTTP and HTTPS proxy using CLI as well. But it did not work. I then tried to use AWS Eclipse Plugin and using it, I can connect to the dynamodb on localhost (through Eclipse only, NOT from the CLI). I want to be able to use CLI for working with local dynamodb.

Please help.

Thanks, Kunal


Solution

  • I fixed this issue by adding following Windows Environment Variables-

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

    It is important to Reboot the PC to reflect these settings.

    Hope it helps someone in need.