Enable dynamodb stream for an existing dynamodb table

2

Hi,

I would like to enable dynamodb stream on an existing dynamodb table using cloudformation template.

I searched but could not find anything in this regard. I see there is way to enable dynamodb stream for an existing table using console but couldn't find any way to achieve same using cloudformation template. Can you help with this .

Satish
질문됨 2년 전2914회 조회
2개 답변
3

Hi, For this you can simply add the StreamSpecification parameter to your table and update the stack:

"StreamSpecification": {
          "StreamViewType": "NEW_AND_OLD_IMAGES"
        }

A sample table with Stream included:

{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Resources": {
    "myDynamoDBTable": {
      "Type": "AWS::DynamoDB::Table",
      "Properties": {
        "AttributeDefinitions": [
          {
            "AttributeName": "id",
            "AttributeType": "S"
          }, 
          {
            "AttributeName": "name",
            "AttributeType": "S"
          }
        ],
        "KeySchema": [
          {
            "AttributeName": "id",
            "KeyType": "HASH"
          }
        ],
        "BillingMode": "PAY_PER_REQUEST",
        "TableName": "testcfn",
        "StreamSpecification": {
          "StreamViewType": "NEW_AND_OLD_IMAGES"
        }
      }
    }
  }
}
profile pictureAWS
전문가
답변함 2년 전
  • Hi, As mentioned in the original post that the table is pre-existing.

    Maybe I should have mentioned that the table is pre-existing and is not managed by cloudformation and is created manually by another team.

    I need to enable the dynamodb stream option for this table using cloud formation. Let me know if any other information is required.

  • Yes, this is for pre-existing, you update the stack. What you failed to mention was that the table did not already belong to a stack. In that case you should use CFN Import Resource tool to import the table to a stack, then add the stream in an subsequent update.

0

Hi Leeroy Hannigan , As per the link you shared , for importing the existing resources into CloudFormation management: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resource-import.html, It doesn't seem to explain an option to import through **CDK ** . how can we achieve that through CDK? In my case here, I created a new pipeline app, stack through CDK for an account thats holding manually created DDB Tables. i would want to import existing DDB tables that were created manually on console and enable stream on these tables. could you please guide me here?

답변함 6달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠