Skip to content

Instantly share code, notes, and snippets.

@serkan-ozal
Created December 22, 2021 14:43
Show Gist options
  • Save serkan-ozal/e2843f20508e747aaef16f684e28ea3b to your computer and use it in GitHub Desktop.
Save serkan-ozal/e2843f20508e747aaef16f684e28ea3b to your computer and use it in GitHub Desktop.
const AWS = require('aws-sdk');
const dynamodb = new AWS.DynamoDB();
exports.hello = async (event, context) => {
const promises = [];
for (let i = 0; i < 1000; i++) {
const params = {
TableName: 'books',
Item: {
'id': {S: i.toString()},
'name': {S: `Book-${i}`}
}
};
const promise = dynamodb.putItem(params).promise();
promises.push(promise);
}
return Promise.all(promises);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment