Example of enabling streaming functionality of DynamoDB table using SAM resource

An example of how to enable streaming functionality of DynamoDB table in template.yaml of your SAM configuration

  YourDynamoDBTable:
    Type: AWS::DynamoDB::Table
    Properties: 
      TableName: 'google-trends'
      AttributeDefinitions: 
        - AttributeName: yourAttribute1
          AttributeType: S
        - AttributeName: yourAttribute2
          AttributeType: S
      KeySchema: 
        - AttributeName: yourAttribute1
          KeyType: HASH
        - AttributeName: yourAttribute2
          KeyType: RANGE
      ProvisionedThroughput: 
        ReadCapacityUnits: 1
        WriteCapacityUnits: 1
      StreamSpecification:
        StreamViewType: NEW_IMAGE

Use StreamSpecification as mentioned above.

More info on the available properties is in the next resource. I use CDK documentation, as I have not found related to SAM resources.

General schema on how to create DynamoDB resource is here:

Schema to create a resource of DynamoDB table using SAM

Last updated