7
votes

Im trying to run dynamoDB locally in Ubuntu. I have done everything as here: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html If I want to check if my database works locally:

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

Im getting:

alexa@alexa-VirtualBox:~/Desktop/DynamoDB$ aws dynamodb list-tables --endpoint-url http://localhost:8000
Unable to locate credentials. You can configure credentials by running "aws configure".

Why? I dont want to use AWS. I thought I can be able to test locally dynamodb without AWS account. Is it possible?

4

4 Answers

11
votes

Despite the fact you're hitting a local endpoint that doesn't require credentials the aws cli tool you're using to interact with the dynamoDB-local still looks for values for the expected AWS credentials to sign your requests with.

This is what the final point in https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.UsageNotes.html is trying to suggest. If you set dummy values for AWS Access Key ID, AWS Secret Access Key and set a default region by running aws configure as suggested you should be able to successfully run commands against your dynamoDB-local instance.

This page on configuring the AWS CLI gives more details on what's going on behind the scenes here.

1
votes

You have to save credentials so that aws cli tool can interact with dynamoDB. You have to save credentials at nano ~/.aws/credentials

[default]
aws_access_key_id = **************
aws_secret_access_key = *******************
0
votes

You can configure the aws credentials as given in below link https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html

$ aws configure
AWS Access Key ID [None]: <your dummy key>
AWS Secret Access Key [None]: <your dummy password>
Default region name [None]: region-name e.g. us-west-2
Default output format [None]: json
-1
votes

You can also use awslocal here like

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

Find more info about awslocal in https://github.com/localstack/awscli-local