in hello-cdk/lib/queue-recorder.ts [12:30]
constructor(parent: cdk.Construct, id: string, props: QueueRecorderProps) {
super(parent, id);
const fn = new lambda.Function(this, 'HelloFunction', {
runtime: lambda.Runtime.NODEJS_12_X,
code: lambda.Code.fromAsset('lambda'),
handler: 'index.handler'
});
fn.addEventSource(new event_sources.SqsEventSource(props.inputQueue));
const table = new dynamodb.Table(this, 'QueueRecorderTable', {
partitionKey: {name: 'id', type: dynamodb.AttributeType.STRING}
});
fn.addEnvironment('TABLE_NAME', table.tableName);
table.grantWriteData(fn.role!);
}