5
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Github Action内でDynamoDB Localを使用する

Posted at

概要

DynamoDB Localを使ったテストをGithub Action内で実行するためのyml

github action

.github/workflows/main.yml

steps:
  - name: Setup DynamoDB Local
    uses: rrainn/dynamodb-action@v2.0.0
    with:
      port: 8000
      cors: '*'
  - name: Create Table
    run |
      aws dynamodb create-table --cli-input-json ./hoge.json --region ap-northeast-1 --endpoint-url http://localhost:8000
    env:
      AWS_ACCESS_KEY_ID: hoge
      AWS_SECRET_ACCESS_KEY: hoge
  - name: test
    run: go test
    env:
      AWS_ACCESS_KEY_ID: hoge
      AWS_SECRET_ACCESS_KEY: hoge

のようにする必要がある。

ハマりポイント

ハマりポイントとしては、テーブルを作成するセクションでawsのキーを設定する必要があり、これはDocに書いてなかったので、結構ハマった。

テスト

テスト側では、http://localhost:8000をエンドポイントに指定して、リージョンに`ap-northeast-1`を指定するとDynamoDB Localに接続出来ると思います。

5
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?