-
Notifications
You must be signed in to change notification settings - Fork 2
/
dyanmo.ts
29 lines (27 loc) · 881 Bytes
/
dyanmo.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { RemovalPolicy } from "aws-cdk-lib";
import {
Table,
AttributeType,
BillingMode,
ProjectionType,
} from "aws-cdk-lib/aws-dynamodb";
import { Construct } from "constructs";
export class DynamoDb extends Construct {
table: Table;
constructor(scope: Construct, id: string) {
super(scope, id);
this.table = new Table(this, `ActivityPubTable`, {
partitionKey: { name: "pk", type: AttributeType.STRING },
sortKey: { name: "sk", type: AttributeType.STRING },
billingMode: BillingMode.PAY_PER_REQUEST,
timeToLiveAttribute: "ttl",
removalPolicy: RemovalPolicy.DESTROY,
});
this.table.addGlobalSecondaryIndex({
indexName: "GSI1",
partitionKey: { name: "GSI1PK", type: AttributeType.STRING },
sortKey: { name: "GSI1SK", type: AttributeType.STRING },
projectionType: ProjectionType.ALL,
});
}
}