Run and test DynamoDB applications locally using Docker and Testcontainers
Use the DynamoDB Local Testcontainers module for your Go applications!
--endpoint-url
soon
- Start the DynamoDB Local Docker container -
dynamodblocal.RunContainer(ctx)
- Gets the client handle for the DynamoDB (local) instance -
dynamodbLocalContainer.GetDynamoDBClient(context.Background())
- Uses the client handle to execute operations. In this case - create a table, add an item, query that item.
- Terminate it at the end of the program (typically register it using
defer
) -dynamodbLocalContainer.Terminate(ctx)
WithTelemetryDisabled
- When specified, DynamoDB local will not send any telemetry.WithSharedDB
- If you use this option, DynamoDB creates a shared database file in which data is stored. This is useful if you want to persist data for e.g. between successive test executions.
WithSharedDB
, here is a common workflow:- Start container and get client handle
- Create table, add data and query it
- Re-start container
- Query same data (again) - Should be there
http://<your_host>:<service_port>
. Most commonly, this is what you would use: http://locahost:8000
Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.