aws-dynamodb
aws-dynamodb copied to clipboard
Dynamo Stream Support
Would it make sense to support streams in this component, or add that functionality with another? For example, we could add streams to the createTable method in utils.js:
async function createTable({ dynamodb, name, attributeDefinitions, keySchema, isStreamActive }) {
const res = await dynamodb
.createTable({
TableName: name,
AttributeDefinitions: attributeDefinitions,
KeySchema: keySchema,
BillingMode: 'PAY_PER_REQUEST',
StreamSpecification: {
StreamEnabled: isStreamActive,
StreamViewType: NEW_IMAGE
}
})
.promise()
return res.TableDescription.TableArn
}
This would definitely belong in this component and we would love to have that. How do you think this would look like as YAML inputs? 🤔
we could just have an optional flag:
myTable:
component: '@serverless/aws-dynamodb'
inputs:
attributeDefinitions:
- AttributeName: id
AttributeType: S
keySchema:
- AttributeName: id
KeyType: HASH
region: us-east-1
stream: true
I think it might be useful to allow people to set the type of stream, which would make this more flexible.
Maybe something like:
myTable:
component: '@serverless/aws-dynamodb'
inputs:
attributeDefinitions:
- AttributeName: id
AttributeType: S
keySchema:
- AttributeName: id
KeyType: HASH
region: us-east-1
streamViewType: NEW_IMAGE
What about triggers? I would add triggers and necessary access roles here.