[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
エキスパート
レビュー済み 1ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ