# Example of enabling streaming functionality of DynamoDB table using SAM resource

```yaml
  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.&#x20;

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

{% embed url="<https://docs.aws.amazon.com/cdk/api/v1/docs/@aws-cdk_aws-dynamodb.StreamViewType.html>" %}

General schema on how to create DynamoDB resource is here:

{% content-ref url="schema-to-create-a-resource-of-dynamodb-table-using-sam" %}
[schema-to-create-a-resource-of-dynamodb-table-using-sam](https://tricks.bodik.tech/infrastructure/aws/sam/schema-to-create-a-resource-of-dynamodb-table-using-sam)
{% endcontent-ref %}
