Skip to content

Manage dynamodb table

Trym Skaar edited this page Feb 24, 2018 · 2 revisions
import ddbes from 'ddbes'

ddbes.config.update({tableName: 'myapp-commits'})

async function setup() {
  await ddbes.dynamodb.createTable({
    tableReadCapacity: 5,
    tableWriteCapacity: 5,
  })

  await ddbes.dynamodb.setupAutoScaling({
    tableReadMinCapacity: 5,
    tableReadMaxCapacity: 100,
    tableWriteMinCapacity: 5,
    tableWriteMaxCapacity: 100,
    utilizationTargetInPercent: 60,
  })
}

async function teardown() {
  await ddbes.dynamodb.removeAutoScaling()
  await ddbes.dynamodb.deleteTable()
}