Can't connect to local DynamoDB even though port 8000 is reachable

0

I was following a tutorial, where at the start, we setup a local dynamodb in a pretty standard way. That worked fine, but when it came time to use the local DDB, i noticed that it was reachable but not responding.

Tutorial: https://aws.plainenglish.io/aws-tutorials-build-a-python-crud-api-with-lambda-dynamodb-api-gateway-and-sam-874c209d8af7

Setup Details

Environment: WSL2 Ubuntu
Docker Container: amazon/dynamodb-local                 latest              904626f640dc   3 months ago   499MB
AWSCLI --version: aws-cli/2.11.21 Python/3.11.3 Linux/5.15.90.1-microsoft-standard-WSL2 exe/x86_64.ubuntu.22 prompt/off
docker --version: Docker version 23.0.5, build bc4487a

Commands used to setup the local DDB :

$ docker network create lambda-local
$ docker run \
    -p 8000:8000 \
    -d \
    --rm \
    --network lambda-local \
    --name dynamodb \
    -v /home/nick/.docker/dynamodb:/data/ \
    amazon/dynamodb-local -jar DynamoDBLocal.jar -sharedDb -dbPath /data

Console output

nick@T490s:~/code$ docker images | grep dynamo
amazon/dynamodb-local                 latest              904626f640dc   3 months ago   499MB

nick@T490s:~/code$ nc -w 1 -v 127.0.0.1 8000
Connection to 127.0.0.1 8000 port [tcp/*] succeeded!

nick@T490s:~/code$ docker ps
CONTAINER ID   IMAGE                   COMMAND                  CREATED        STATUS        PORTS                    NAMES
cd8721008dd4   amazon/dynamodb-local   "java -jar DynamoDBL…"   22 hours ago   Up 22 hours   0.0.0.0:8000->8000/tcp   dynamodb

nick@T490s:~/code$ aws dynamodb list-tables --endpoint-url http://127.0.0.1:8000 --profile default --debug
Output here: https://pastebin.com/zfEBQnd9

If you need me to edit my post with any other troubleshooting commands, just say so and I will update asap.

Thanks for the help!

Nick
asked a year ago936 views
1 Answer
1

Hi, it may come from an issue with your version of Python urllib3.

Which one do you have installed?

See https://urllib3.readthedocs.io/en/stable/

profile pictureAWS
EXPERT
answered a year ago
  • Hi Didier, I don't have urllib3 installed it seems. If it was required for the awscli, wouldn't it have been installed as a dependency? Also, I failed to connect NoSQL Workspace to my docker DDB container and that is from outside the WSL environment.

    nick@T490s:~/code$ python import urllib3 Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'urllib3'

  • Nick, the gist that you posted: https://pastebin.com/zfEBQnd9 contains references to urllib3

    Traceback (most recent call last): File "urllib3/connectionpool.py", line 449, in _make_request File "<string>", line 3, in raise_from File "urllib3/connectionpool.py", line 444, in _make_request File "http/client.py", line 1375, in getresponse File "http/client.py", line 318, in begin File "http/client.py", line 279, in _read_status File "socket.py", line 706, in readinto TimeoutError: timed out

    So, can you look for the file urllib3/connectionpool.py ?

  • Hi Didier, I thought it would be an awscli library so I went looking in there and did not find it.

    nick@T490s:/usr/local/aws-cli/v2$ find . -type f -name *.py # This returns nothing

    So I installed urllib3 fresh with pip and the exact same error occurred. Here is the output: https://pastebin.com/AgMcp4JL

    Finally, I installed the locate tool and used it to find all files named connectionpool.py. The output basically all my venv environments, and the freshly installed urllib3 library that I just installed with pip. The output is here: https://pastebin.com/228RQRSC

  • Can you now check the version of urllib3 via methods of https://blog.finxter.com/how-to-check-urllib3-package-version-in-python/

  • Hi Didier, urllib3 2.0.2. Are we sure that AWScli is using the system python library and not something that came bundled with the cli? It was previously not installed and had the exact same error after installing with the system pip.

    nick@T490s:/usr/local/aws-cli/v2$ pip list | grep urllib3 urllib3 2.0.2

    import urllib3 urllib3.version '2.0.2'

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions