Skip to content

Instantly share code, notes, and snippets.

@SoftwareDevPro
Created September 3, 2020 22:52
Show Gist options
  • Select an option

  • Save SoftwareDevPro/61b33fbfc233eee7cd3ed50fbb52e9be to your computer and use it in GitHub Desktop.

Select an option

Save SoftwareDevPro/61b33fbfc233eee7cd3ed50fbb52e9be to your computer and use it in GitHub Desktop.
Create an Item in a DynamoDB table
async function createItem () {
const createdUpdated = (new Date()).getTime();
let params = {
TableName: tableName,
Item: {
'userId': 'userId',
'createdAt': createdUpdated,
'updatedAt': createdUpdated
}
}
try {
await ddbObj.put(params).promise()
} catch (error) {
console.log(error)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment