This is a quickstart project for creating a Typescript AWS Lambda function that transforms a Kinesis event in AWS Firehose. The project is based on the AWS Lamdba Deploying transpiled Typescript with .zip file documentation.
-
Navigated to hello-world dir and execute npm build:
cd hello-world npm run build
This will create a dist
directory with the transpiled code, and the index.zip file.
-
Next, create the lambda IAM execution role, navigate to the
root
directory and execute the following command:aws iam create-role --role-name lambda-role --assume-role-policy-document file://role.json
-
Use the aws cli 2 to create the lambda function:
aws lambda create-function --function-name dynamodb-firehose-lambda-transformer --runtime "nodejs18.x" --role arn:aws:iam::<your-aws-account-id>:role/lambda-role --zip-file "fileb://dist/index.zip" --timeout 60 --handler index.handler
-
Last, navigate to AWS Firehose, enable the data transformation and select the lambda function you just created.