Skip to content

utgwkk/dynamodb-local-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dynamodb-local-proxy

Motivation

dynamodb-local-proxy is a lightweight HTTP proxy for DynamoDB Local that automatically supplements the DescribeTable API response with the missing WarmThroughput field.

It solves the compatibility issue where terraform-provider-aws v6.13+ (and potentially other modern clients) now expect WarmThroughput in DescribeTable output1. DynamoDB Local (up to 3.3.0) does not return this field, causing Terraform to hang indefinitely waiting for table creation and eventually time out.

By sitting in front of DynamoDB Local and injecting a dummy WarmThroughput value only for DescribeTable calls, the proxy makes DynamoDB Local fully compatible with the latest Terraform AWS provider without changing any application code.

詳しくは TerraformでDynamoDB localのテーブルを作成しようとするとタイムアウトする現象 - 私が歌川です を読んでください。

Environment Variables

Variable Default Description
DYNAMODB_LOCAL_ADDR localhost:8000 Address of DynamoDB Local to proxy requests to
HOST localhost Host address the proxy listens on
PORT 8888 Port the proxy listens on
LOG_LEVEL INFO Log level (DEBUG, INFO, WARN, ERROR)

Usage

With AWS CLI

You can get patched response by executing aws --endpoint-url=http://localhost:8888 dynamodb describe-table --table-name <table-name>.

Run with Docker Compose

services:
  dynamodb-local:
    command: -jar DynamoDBLocal.jar -sharedDb -dbPath ./data
    image: amazon/dynamodb-local
    volumes:
      - "./docker/dynamodb:/home/dynamodblocal/data"
    working_dir: /home/dynamodblocal
  dynamodb-local-proxy:
    image: ghcr.io/utgwkk/dynamodb-local-proxy
    environment:
      - DYNAMODB_LOCAL_ADDR=dynamodb-local:8000
      - HOST=0.0.0.0
      - PORT=8888
    ports:
      - "8888:8888"

Run with GitHub Actions

Using Docker Compose's bridge network mode with GitHub Actions can be slow, so I recommend starting it using the services method in GitHub Actions workflows.

on:
  push:
    branches:
      - main
  pull_request:
jobs:
  test:
    runs-on: ubuntu-latest
    services:
      dynamodb-local:
        image: amazon/dynamodb-local
      dynamodb-local-proxy:
        image: ghcr.io/utgwkk/dynamodb-local-proxy
        env:
          DYNAMODB_LOCAL_ADDR: dynamodb-local:8000
          HOST: 0.0.0.0
          PORT: 8888
        ports:
          - 8888:8888
    steps:
      - run: aws --endpoint-url=http://localhost:8888 dynamodb list-tables

Footnotes

  1. https://github.com/hashicorp/terraform-provider-aws/pull/41308

About

A lightweight HTTP proxy for DynamoDB Local with Terraform

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors