Search code examples
amazon-dynamodb

How to use aws-cli with local dynamoDB ?


I am struggling with using aws-cli with dynamoDB running on my local machine, could anyone please help.

DynamoDB Local with the following configuration:

Port:   8000
InMemory:   false
DbPath: null
SharedDb:   true
shouldDelayTransientStatuses:   false
CorsParams: *

any help appreciated.


Solution

  • From the documentation:

    Using the AWS CLI with Downloadable DynamoDB

    The AWS CLI can interact with DynamoDB running on your computer. To enable this, add the --endpoint-url parameter to each command:

    --endpoint-url http://localhost:8000

    Here is an example, using the AWS CLI to list the tables in a local database:

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

    Note: if you don't have any AWS credentials configured yet, the command above may fail with You must specify region or Unable to locate credentials error. For the local connection any credentials would work, so arbitrary values can be used, for example, like this:

    AWS_ACCESS_KEY_ID=X AWS_SECRET_ACCESS_KEY=X aws dynamodb list-tables --endpoint-url http://localhost:8000 --region x