Can not connect to DynamoDB locally

0

Hello. I need to set up dynamoDB locally. I made everything by instruction.

  1. Run it in docker
  2. It works I see this:
amazon/dynamodb-local:latest   "java -jar DynamoDBL…"   19 hours ago   Up 2 hours   0.0.0.0:8000->8000/tcp, :::8000->8000/tcp
  1. Try to connect by the instruction
aws dynamodb list-tables --endpoint-url http://localhost:8000

But I don't have any results. It just wailt without any logs in console. I tryed to call it manually

curl http://localhost:8000

It returns

{"__type":"com.amazonaws.dynamodb.v20120810#MissingAuthenticationToken","Message":"Request must contain either a valid (registered) AWS access key ID or X.509 certificate."}

I totally don't understand what to do. I don't see errors and I don't see result. Do you know how to debug it? Or may be is an instrucation. Help me please.

jangot
asked a year ago3332 views
6 Answers
3

{"__type":"com.amazonaws.dynamodb.v20120810#MissingAuthenticationToken","Message":"Request must contain either a valid (registered) AWS access key ID or X.509 certificate."}

The reason you see this exception is because you curled the endpoint, curl does not sign requests so the exception is expected.

As for your actual issue, you need to ensure that you use credentials to connect to DynamoDB Local. You need to use aws configure to configure credentials (for local they do not have to be valid credentials).

As you already have credentials saved as local then you should execute this command:

aws dynamodb list-tables \
--endpoint-url http://localhost:8000 \
--profile local \
--debug

--debug will highlight where the request is failing, if it still fails.

profile pictureAWS
EXPERT
answered a year ago
  • Hi Leeroy. I have the exact same issue. I am running DDB in a docker container on my WSL Ubuntu. Everything is the same as the original poster except I can confirm that a netcat returns successfully, but anything else refuses to connect. Since this thread is only two weeks old, could this be a new bug or something like that?

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

  • Hi Nick, yours looks like a separate issue. Can you create a new question and include the version of Local you are using along with your Docker setup commands?

  • Hi Leeroy, thanks for the response. I made a separate issue here: https://repost.aws/en/questions/QUN54ZAARaQjSKRGgg-qPnog/

-1

Hi, if above does not fix it, I would suggest to follow this topic as could be related to some bug introduced in specific versions for local DynamoDB.

https://repost.aws/questions/QUHyIzoEDqQ3iOKlUEp1LPWQ#ANdBm9Nz9TRf6VqR3jZtcA1g

profile picture
EXPERT
answered a year ago
-2

DynamoDB local requires Access Key ID and Secret Key ID to authenticate. This can be any set of valid credentials.

I would recommend setting up the Access Key ID and Secret Key ID in your AWS CLI -> https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html

Then add the --profile parameter to the "aws dynamodb" command referencing the profile name you created when setting up the credentials.

aws dynamodb list-tables --endpoint-url http://localhost:8000 --profile myprofile
profile picture
Bisina
answered a year ago
-2

Sorry what does it mean: "This can be any set of valid credentials."? Where can I get the credentials for local DB? It has value by default? Or I need to specifiy it some how?

jangot
answered a year ago
-2

I have this in my credentials file

[local]
aws_access_key_id=dummy-access-key
aws_secret_access_key=dummy-access-key

and config

[local]
region = us-west-2

And I call it so

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

or so

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

Do I need to use the keys or I need generate it some how? Or specifty it? Whant is wrong?

jangot
answered a year ago
-2

On your IAM user, you can generate a set of credentials -> https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html

What I meant by "This can be any set of valid credentials" is that the aws_access_key_id and aws_secret_access_key need to be an actual set of credentials generated in AWS.

Generate the credentials then update the local credentials file then you can simply run the following, You do not need to specify the region as local. The region parameter is only valid when we call AWS services in specific regions since we are using the --endpoint-url the CLI automatically calls the local instance.

aws dynamodb list-tables --endpoint-url http://localhost:8000 --profile local
profile picture
Bisina
answered a year ago

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