-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
34 lines (27 loc) · 894 Bytes
/
index.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
30
31
32
33
34
import { BillingMode } from '@aws-cdk/aws-dynamodb';
import cdk = require('@aws-cdk/core');
import { Duration } from '@aws-cdk/core';
import { Schedule } from '@aws-cdk/aws-events';
import { Shape, DynamoDB, Lambda } from 'punchcard';
const { dynamic, string, integer, struct } = Shape;
const app = new cdk.App();
const stack = new cdk.Stack(app, 'TaskExample');
// NOTE: make sure you export the app as default, or else your code won't run at runtime
export default app;
// create and use punchcard or CDK constructs
const personsTable = new DynamoDB.Table(stack, 'PersonsTable', {
partitionKey: 'id',
shape: {
id: string(),
count: integer({
minimum: 0
})
},
billingMode: BillingMode.PAY_PER_REQUEST
});
new Lambda.Function(stack, 'PersonsList', {
depends: personsTable,
handle: async (event, personsTable) => {
return await personsTable.scan()
}
});