Are CloudWatch Events input transformers supported?
The input block for cloudwatch events seems to supported only constant input or inputPaths (subsetting part of the actual event).
I would like to pass constant data alongside the actual event.
Are CloudWatch Events input transformers supported?
The input block for cloudwatch events seems to supported only constant input or inputPaths (subsetting part of the actual event).
I would like to pass constant data alongside the actual event.
The documentation doesn’t seem entirely clear … the following (a) preserves the actual event, and (b) adds new fields to the detail
object:
events:
- schedule:
rate: rate(1 minute)
inputTransformer:
inputPathsMap:
version: '$.version'
id: '$.id'
detail-type: '$.detail-type'
source: '$.source'
account: '$.account'
time: '$.time'
region: '$.region'
resources: '$.resources'
inputTemplate: '{"version": <version>, "id" : <id>, "detail-type": <detail-type>, "source": <source>, "account": <account>, "time": <time>, "region": <region>, "resources": <resources>, "detail": { "tz": "America/Chicago", "dst": true } }'
Here is the event object, as passed to the Lambda function:
{
"version": "0",
"id": "3e3187de-58bd-bb7f-36af-aaba7df33719",
"detail-type": "Scheduled Event",
"source": "aws.events",
"account": "...",
"time": "2020-12-02T16:28:36Z",
"region": "us-east-1",
"resources": [
"arn:aws:events:us-east-1:...:rule/serverless-tes..."
],
"detail": {
"tz": "America/Chicago",
"dst": true
}
}