我正在使用CDK在DynamoDB上创建一个全局表。我想在所有的复制品上设置实时恢复。但是,PITR只在原始表上设置,而不是在其他副本上设置。这是我的密码。
import { Stack, StackProps, App } from 'aws-cdk-lib';
import { Table, BillingMode, AttributeType, StreamViewType } from 'aws-cdk-lib/aws-dynamodb';
export class HelloCdkStack extends Stack {
constructor(scope: App, id: string, props?: StackProps) {
super(scope, id, props);
new Table(this, 'Movies', {
tableName: 'Music',
partitionKey: {
name: 'Artist',
type: AttributeType.STRING
},
sortKey: {
name: 'SongTitle',
type: AttributeType.STRING
},
billingMode: BillingMode.PAY_PER_REQUEST,
replicationRegions: ['eu-west-1'],
pointInTimeRecovery: true,
stream: StreamViewType.NEW_AND_OLD_IMAGES,
});
}
}发布于 2022-01-13 10:27:00
我想出了解决这个问题的办法。我对全局表使用了L1构造。我之前使用的L2构造似乎不支持为副本设置PITR。下面是一个有效的代码示例
new CfnGlobalTable(this, 'Music', {
tableName: 'Music',
attributeDefinitions: [
{attributeName: 'SongTitle', attributeType: AttributeType.STRING},
],
keySchema: [{attributeName: 'SongTitle', keyType: 'HASH'}],
billingMode: BillingMode.PAY_PER_REQUEST,
streamSpecification: { streamViewType: "NEW_AND_OLD_IMAGES" },
replicas: ['us-east-1', 'eu-west-1'].map(region => {
return {
region: region,
pointInTimeRecoverySpecification: { pointInTimeRecoveryEnabled: true }
};
})
});https://stackoverflow.com/questions/70687039
复制相似问题