[CDK] Enable Kinesis DS from DDB stream

0

I know that CDK may have limitation due to CFN having some lag on new features. I am trying to enable Kinesis DS from DDB stream like this console menu.

Is this possible from CDK? I searched and eventually gave up. I was wondering if you know this enablement from CDK.

profile pictureAWS
질문됨 3년 전895회 조회
1개 답변
0
수락된 답변

You can do this in CDK by few lines of code:

import * as cr from "@aws-cdk/custom-resources";

    const ddbToKinesis = new cr.AwsCustomResource(
  this,
  "CustomResourceDDBtoKinesis",
  {
    policy: cr.AwsCustomResourcePolicy.fromStatements([
      new iam.PolicyStatement({
        actions: [
          "dynamodb:EnableKinesisStreamingDestination",
          "dynamodb:DisableKinesisStreamingDestination",
          "dynamodb:DescribeKinesisStreamingDestination",
        ],
        effect: iam.Effect.ALLOW,
        resources: [tableArn],
      }),
      new iam.PolicyStatement({
        actions: ["kinesis:*"],
        effect: iam.Effect.ALLOW,
        resources: [streamArn],
      }),
    ]),
    onCreate: {
      service: "DynamoDB",
      action: "enableKinesisStreamingDestination",
      parameters: {
        StreamArn: streamArn,
        TableName: tableName,
      },
      physicalResourceId: cr.PhysicalResourceId.of(Date.now().toString()),
    },
    onDelete: {
      service: "DynamoDB",
      action: "disableKinesisStreamingDestination",
      parameters: {
        StreamArn: replicationStream.streamArn,
        TableName: tableName,
      },
      physicalResourceId: cr.PhysicalResourceId.of(Date.now().toString()),
    },
    installLatestAwsSdk: true,
  }
);
답변함 3년 전
profile picture
전문가
검토됨 한 달 전

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

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

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

관련 콘텐츠