For local development, I run DynamoDB locally in Docker.
docker run -p 8000:8000 amazon/dynamodb-local
I can connect to it, query it, and populate tables with commands like
aws dynamodb --endpoint-url http://localhost:8000 list-tables
My program also runs in docker. I'm on a mac so the program must use a dynamo URL like http://docker.for.mac.localhost:8000
but it can connect, query and populate the database.
The problem is that those two mechanism, hitting dynamo from outside docker and hitting dynamo from inside docker, see two completely separate dynamo databases. If I create a table from inside docker, I can't see it from outside docker and vice versa.
> aws dynamodb --endpoint-url http://localhost:8000 list-tables
{
"TableNames": []
}
> docker run --rm amazon/aws-cli dynamodb --endpoint-url http://docker.for.mac.localhost:8000 list-tables
{
"TableNames": [
"SampleTable"
]
}
Does local Dynamo create whole separate environments based on the URL you come in on?
My guess here is it's different profile credentials being used, which does create a different data store for each unique permission tokens.
I'll suggest that you enable DynamoDB local with the -shareDb
flag, which will create a shared environment for all access keys:
If you use the -sharedDb option, DynamoDB creates a single database file named shared-local-instance.db. Every program that connects to DynamoDB accesses this file. If you delete the file, you lose any data that you have stored in it.