aws-dynamodb icon indicating copy to clipboard operation
aws-dynamodb copied to clipboard

Dynamo Stream Support

Open dodgeblaster opened this issue 6 years ago • 4 comments

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
}

dodgeblaster avatar Aug 24 '19 16:08 dodgeblaster

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? 🤔

eahefnawy avatar Aug 26 '19 08:08 eahefnawy

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

dodgeblaster avatar Aug 26 '19 19:08 dodgeblaster

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

ryanwalters avatar Oct 28 '19 16:10 ryanwalters

What about triggers? I would add triggers and necessary access roles here.

mstn avatar Dec 04 '19 14:12 mstn