Skip to content

Instantly share code, notes, and snippets.

@radzionc
Last active October 7, 2020 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radzionc/c4b75adf7d1889d17ae326214fc69348 to your computer and use it in GitHub Desktop.
Save radzionc/c4b75adf7d1889d17ae326214fc69348 to your computer and use it in GitHub Desktop.
require('dotenv').config()
const aws = require('aws-sdk')
const localDynamo = require('local-dynamo')
const { setupAWS } = require('../src/utils/aws')
const { TABLES_PARAMS } = require('../../constants/db')
module.exports = async () => {
setupAWS()
localDynamo.launch(null, process.env.DYNAMO_TESTING_PORT)
const dynamodb = new aws.DynamoDB()
try {
const data = await Promise.all(
TABLES_PARAMS.map(params => dynamodb.createTable(params).promise())
)
console.log('Database created: ', JSON.stringify(data, null, 2))
} catch (err) {
console.error('Unable to create table: ', JSON.stringify(err, null, 2))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment