File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed
Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change 1+ export const handler = async ( ) => {
2+ // Implement your event processing code here.
3+
4+ return {
5+ statusCode : 200 ,
6+ body : JSON . stringify ( {
7+ message : 'Hello World!'
8+ } )
9+ }
10+
11+ }
Original file line number Diff line number Diff line change @@ -46,19 +46,18 @@ export class EventConsumer extends Construct {
4646 alarmDescription : 'Messages are getting old in the queue'
4747 } ) ;
4848
49- /* Uncomment the following code block to add Lambda functions to process items from the Queue
50- // CDK code for observable Lambda function
49+ // CDK code for observable Lambda consumer
5150 const processingFunction = new aws_lambda . Function ( this , 'EventProcessingFunction' , {
5251 runtime : aws_lambda . Runtime . NODEJS_22_X ,
5352 handler : 'index.handler' ,
5453 code : aws_lambda . Code . fromAsset ( 'lambda' ) ,
5554 tracing : aws_lambda . Tracing . ACTIVE , // Enable X-Ray tracing
5655 environment : {
57- LOG_LEVEL: 'INFO',
58- METRICS_NAMESPACE: 'EventProcessing'
56+ LOG_LEVEL : 'INFO' ,
57+ METRICS_NAMESPACE : 'EventProcessing'
5958 }
6059 } ) ;
61-
60+
6261 // Grant permissions for CloudWatch metrics
6362 processingFunction . addToRolePolicy ( new aws_iam . PolicyStatement ( {
6463 actions : [ 'cloudwatch:PutMetricData' ] ,
@@ -70,6 +69,5 @@ export class EventConsumer extends Construct {
7069 processingFunction . addEventSourceMapping ( 'EventSourceMapping' , {
7170 eventSourceArn : this . queue . queueArn
7271 } ) ;
73- */
7472 }
7573}
You can’t perform that action at this time.
0 commit comments