Enable a DynamoDB Stream via yaml

134 views Asked by At

I have a DynamoDB table and I need to enable a stream without lose the table data.

I can do it via web console, but I need to do using a yaml template and a cloud formation stack.

Is it possible without recreate the table?

I tried to upload the yaml of my table adding the StreamSpecification, but I get the error Resource of type 'AWS::DynamoDB::Table' with identifier 'Users' already exists.

AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Description: Stream

Resources:
  Users:
    Type: AWS::DynamoDB::Table
    Properties:
      StreamSpecification:
        StreamViewType: NEW_IMAGE
      KeySchema:
        - AttributeName: name
          KeyType: HASH
        - AttributeName: city
          KeyType: RANGE
      AttributeDefinitions:
        - AttributeName: name
          AttributeType: S
        - AttributeName: city
          AttributeType: S
      BillingMode: PAY_PER_REQUEST
      TableName: Users
    UpdateReplacePolicy: Retain
    DeletionPolicy: Retain
1

There are 1 answers

0
Marcin On

You have to import your existing DynamoDB table into CloudFormation first, before you can modify it from your yaml.