Skip to content

Instantly share code, notes, and snippets.

@deangiberson
Created January 28, 2018 23:47
Show Gist options
  • Save deangiberson/4da77e5336358789b317a2e6fd0abae5 to your computer and use it in GitHub Desktop.
Save deangiberson/4da77e5336358789b317a2e6fd0abae5 to your computer and use it in GitHub Desktop.
dynamodb.deleteTable({
TableName: 'record'
})
dynamodb.createTable({
TableName: 'record',
AttributeDefinitions: [
{ AttributeName: 'name', AttributeType: 'S' },
{ AttributeName: 'part', AttributeType: 'N' }
],
KeySchema: [
{ AttributeName: 'name', KeyType: 'HASH' },
{ AttributeName: 'part', KeyType: 'RANGE' }
],
StreamSpecification: {
StreamEnabled: true,
StreamViewType: 'NEW_AND_OLD_IMAGES'
},
ProvisionedThroughput: {
ReadCapacityUnits: 5,
WriteCapacityUnits: 5
}
}, function (err, data) {
if (err) {
console.log(err, err.stack)
} else {
// data.TableDescription.StreamSpecification and
// data.TableDescription.LatestStreamArn are undefined
// for dynamodb local
console.log(data)
}
})
dynamodb.putItem({
TableName: 'record',
Item: {
'name': {S:'9094bea143d57c048517acd03a052f1ed3b7a46403a510529c900c31c02b7234'},
'part': 0,
'filesize':100
}
})
dynamodb.putItem({
TableName: 'record',
Item: {
'name': {S:'7e973cfb28619aa8aad470ec077f9da92e7b284f002fb9bbfe4f0352345a7f72'},
'part': 0,
'filesize':9833
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment