Skip to content

Instantly share code, notes, and snippets.

@jenseickmeyer
Last active April 3, 2018 13:21
Show Gist options
  • Save jenseickmeyer/cc3ce96671fbd76864dc9ea9df2979ea to your computer and use it in GitHub Desktop.
Save jenseickmeyer/cc3ce96671fbd76864dc9ea9df2979ea to your computer and use it in GitHub Desktop.
AWS Lambda function using async/await
'use strict';
const aws = require('aws-sdk');
const dynamoDB = new aws.DynamoDB.DocumentClient();
exports.handler = async (event, context) => {
return await getItems();
};
async function getItems() {
const params = {
TableName: 'TABLENAME'
};
const data = await dynamoDB.scan(params).promise();
return data.Items;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment