1

We are using Dynamodb Local to do integration testing. It is launched inside a container, and within that container, we need to connect to Dynamodb local. Here is how the DocumentClient is initialized:

const doc = new AWS.DynamoDB.DocumentClient({
  region: 'localhost',
  endpoint: 'http://localhost:5000/'
});

However, when I try connect try batchwrite, like so doc.batchWrite(buildSetData).promise(), the promise is never fulfilled. For those that are wondering, the batchwrite is in JavaScript, and .promise() just returned a JS promise.

However, when I run my setup locally (outside of docker container), everything works perfectly.

TLDR: Why can't I connect to DynamoDb Local inside my container.

Barry Steyn
  • 1,563
  • 3
  • 19
  • 25

1 Answers1

2

The problem was due to the docker environment not having credentials. I assumed that dynamodb-local would not need AWS credentials, and even though it is not making connected to AWS, dynamodb-local still needs them (in fact, they can even be non-sensical credentials, as long as the keys are present).

TLDR: If anyone else has this problem, just define the following keys in your docker env:

AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
Barry Steyn
  • 1,563
  • 3
  • 19
  • 25