Slide 15
Slide 15 text
const lambdaFunction = new nodejsLambda.NodejsFunction(/*略*/)
lambdaFunction.addToRolePolicy(
new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
actions: ["dynamodb:Scan"],
resources: ["*"],
})
);
props.ddbTable.grantWriteData(lambdaFunction);
const provider = new cr.Provider(this, "CustomResourceProvider", {
onEventHandler: lambdaFunction,
});
new cdk.CustomResource(this, "CustomResource", {
serviceToken: provider.serviceToken,
properties: {
tableName: props.ddbTable.tableName,
} as ResourceProperties,
});
利⽤イメージ(CDK側)
const originalTable = new dynamodb.Table(/* 略 */)
new DynamoDbTableItemsRestorer(this,'OriginalTableItemsRestorer',{
ddbTable: originalTable
})
利⽤例