const AWS = require("aws-sdk"), TABLE_NAME = "HOGE", client = new AWS.DynamoDB.DocumentClient({ httpOptions : { timeout: 3000 }, maxRetries : 0 }); client.get({ TableName : TABLE_NAME, Key : { keyname : "FUGA" } }, (err, data) => { if (err) { console.log(err); } else { console.log(data); } }); client.put({ TableName : TABLE_NAME, Item : { keyname : "FUGA", timestump : Date.now() } }, (err, data) => { if (err) { console.log(err); } else { console.log(data); } });
という感じで、clientを作るときの引数に、
{ httpOptions : { timeout: 3000 }, maxRetries : 0 }
と、timeoutを渡せばOKでした。単位はmsです。
ただし、一緒にmaxRetriesを渡さないと機能しませんでした。