1
1

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.

DynamodbLocalにJavascriptで接続する際の事前設定

Last updated at Posted at 2019-12-17

DynamodbLocalにJavascriptで接続する際、アクセスキーIDとかリージョンとかを設定していないと怒られます。こんな感じに。

Error [ConfigError]: Missing region in config

ローカルで動かしているので本来設定の必要はないはずですが……まあともかく設定が必要です。
具体的には以下の四項目を設定しておく必要があります。

  • AWSaccessKeyId
  • AWSsecretAccessKey
  • AWSregion
  • AWSendpoint

設定方法はこちら。AWSendpointだけは実際にDynamodbが動いているエンドポイントを指定する必要がありますが、それ以外は適当で大丈夫です。

index.js
const AWS = require('aws-sdk')

const AWSaccessKeyId = 'none';
const AWSsecretAccessKey = 'none';      
const AWSregion = 'none';
const AWSendpoint = 'http://localhost:8000'
AWS.config.update({
    accessKeyId: AWSaccessKeyId,
    secretAccessKey: AWSsecretAccessKey,  
    region: AWSregion,
    endpoint: AWSendpoint
});
1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?