1 回答
- 最新
- 投票最多
- 评论最多
1
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,
}
);
已回答 4 年前
相关内容
- AWS 官方已更新 10 个月前
- AWS 官方已更新 7 个月前
- AWS 官方已更新 8 个月前
- AWS 官方已更新 2 年前