krisdigitx krisdigitx - 6 months ago 58
Linux Question

aws cli cannot read from dynamodb docker container

i am running dynamodb on a docker container and am able to write to the table using python boto3, which is all fine and good.

now when I query the dynamodb table from outside the container using aws CLI, its give this error and cannot find the table

╰─➤ aws dynamodb --region=eu-west-1 --endpoint-url http://localhost:8000 scan --table-name devApiConfig

A client error (ResourceNotFoundException) occurred when calling the Scan operation: Cannot do operations on a non-existent table

the name of the sqlite db created by dynamodb docker container is


aws --region=eu-west-1 dynamodb list-tables --endpoint-url http://localhost:8000
"TableNames": []

Any ideas or hints, as the tables do exist on the dynamodb when used from Boto3....?


I have answered this in another question:

Check how your docker is starting Dyanmo. If you are using deangiberson/aws-dynamodb-local (as I was), then you will need to change the start parameters to add -sharedDb. Either amend the Dockerfile or run as follows:

docker run -p 8000:8000 -d -it deangiberson/aws-dynamodb-local "-sharedDb"

I haven't tested, so let me know if this doesn't work, but hopefully you get the idea.