Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e2e4286

Browse files
authored
Merge pull request #201 from aws-samples/2024-07-26-evergreen-batch-snippets
EGCS update for 07/26/2024. This update includes:
2 parents e7ab62b + a9b20ab commit e2e4286

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

.doc_gen/metadata/serverless_metadata.yaml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,12 +691,15 @@ serverless_connect_RDS_Lambda:
691691
languages:
692692
JavaScript:
693693
versions:
694-
- sdk_version: 2
694+
- sdk_version: 3
695695
github: https://github.com/aws-samples/serverless-snippets/tree/main/lambda-function-connect-rds-iam
696696
excerpts:
697-
- description: Connecting to an &RDS; database in a &LAM; function using Javascript.
697+
- description: Connecting to an &RDS; database in a &LAM; function using JavaScript.
698698
snippet_files:
699699
- lambda-function-connect-rds-iam/example.js
700+
- description: Connecting to an &RDS; database in a &LAM; function using TypeScript.
701+
snippet_files:
702+
- lambda-function-connect-rds-iam/example.ts
700703
Python:
701704
versions:
702705
- sdk_version: 3
@@ -748,3 +751,21 @@ serverless_connect_RDS_Lambda:
748751
services:
749752
lambda:
750753
rds:
754+
serverless_MSK_Lambda:
755+
title: Invoke a &LAM; function from an &MSK; trigger
756+
title_abbrev: Invoke a &LAM; function from an &MSK; trigger
757+
synopsis: implement a Lambda function that receives an event triggered by receiving records from
758+
an Amazon MSK cluster. The function retrieves the MSK payload and logs the record contents.
759+
category: Serverless examples
760+
languages:
761+
JavaScript:
762+
versions:
763+
- sdk_version: 3
764+
github: https://github.com/aws-samples/serverless-snippets/tree/main/integration-msk-to-lambda
765+
excerpts:
766+
- description: Consuming an &MSK; event with &LAM; using JavaScript.
767+
snippet_files:
768+
- integration-msk-to-lambda/example.js
769+
services:
770+
lambda:
771+
kafka:
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
exports.handler = async (event) => {
5+
// Iterate through keys
6+
for (let key in event.records) {
7+
console.log('Key: ', key)
8+
// Iterate through records
9+
event.records[key].map((record) => {
10+
console.log('Record: ', record)
11+
// Decode base64
12+
const msg = Buffer.from(record.value, 'base64').toString()
13+
console.log('Message:', msg)
14+
})
15+
}
16+
}

0 commit comments

Comments
 (0)