Skip to content

Instantly share code, notes, and snippets.

@cmackenzie1
Last active October 12, 2024 08:33
Show Gist options
  • Save cmackenzie1/92e0c3628da6842f0e9ffeca8abbe170 to your computer and use it in GitHub Desktop.
Save cmackenzie1/92e0c3628da6842f0e9ffeca8abbe170 to your computer and use it in GitHub Desktop.
Docker Compose for DynamoDB Local and Admin UI
version: '3.7'
services:
dynamodb-local:
image: amazon/dynamodb-local:latest
container_name: dynamodb-local
ports:
- "8000:8000"
dynamodb-admin:
image: aaronshaf/dynamodb-admin
ports:
- "8001:8001"
environment:
DYNAMO_ENDPOINT: "http://dynamodb-local:8000"
AWS_REGION: "us-west-2"
AWS_ACCESS_KEY_ID: local
AWS_SECRET_ACCESS_KEY: local
depends_on:
- dynamodb-local
@cmackenzie1
Copy link
Author

@mxmzb it would depend on your specific setup. The AWS SDK (in the language of your choice) should at least specify the same region as the configured Docker container.

If you are relying on profiles in your ~/.aws/credentials file, then the region for the selected profile would need to match.

@njlr
Copy link

njlr commented Apr 26, 2024

I was unable to see tables created by different scripts until I enabled sharedDb mode.

Note the command property...

version: '3.9'
services:

  dynamodb:
    image: amazon/dynamodb-local:2.4.0
    command: "-jar DynamoDBLocal.jar -sharedDb"
    healthcheck:
      test: [ "CMD-SHELL", "curl -v http://dynamodb:8000" ]
      interval: 3s
      timeout: 3s
      retries: 5
      start_period: 3s
    ports:
      - "8000:8000"
    restart: always

  dynamodb-admin:
    image: aaronshaf/dynamodb-admin:4.6.1
    ports:
      - "8001:8001"
    environment:
      DYNAMO_ENDPOINT: "http://dynamodb:8000"
      AWS_REGION: "eu-west-2"
      AWS_ACCESS_KEY_ID: abc
      AWS_SECRET_ACCESS_KEY: def
    depends_on:
      dynamodb:
        condition: service_healthy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment