How to use aws-cli with local dynamoDB ?

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

All is need is to run aws configure:

aws configure
AWS Access Key ID [None]: "fakeMyKeyId"
AWS Secret Access Key [None]: "fakeSecretAccessKey"
Default region name [None]: x
Default output format [None]:

After that.

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

{
   "TableNames": []
}

Other alternative: Create the "myprofile" profile.

aws configure --profile myprofile
AWS Access Key ID [None]: "fakeMyKeyId"
AWS Secret Access Key [None]: "fakeSecretAccessKey"
Default region name [None]: x
Default output format [None]:

Then

aws dynamodb list-tables --endpoint-url http://localhost:8000 --profile myprofile
    
{
   "TableNames": []
}