I think this is possible? I have a lambda and api gateway defined in a sam template. I use sam-local to start that up. Within my lambda I would like to connect to my local dynamoDB but the lambda keeps timing out. Code looks like:
let AWS = require('aws-sdk')
let dyn= new AWS.DynamoDB({ endpoint: new AWS.Endpoint("http://localhost:8000") })
function handler(event, context, callback) {
dyn.listTables({Limit: 10}, function(err, data) {
if (err) {
console.log("Error", err.code)
} else {
console.log("Table names are ", data.TableNames)
}
})
let response = {
statusCode: 200
}
callback(null, response)
}
If this code is run outside of a lambda it works fine