Hi all! Is there anyway to hook a lambda function ...
# aws
a
Hi all! Is there anyway to hook a lambda function with a Cloudwatch Event rule that returns a static JSON? The
EventRule.onEvent
doesn’t seem to support customize the payload and only support the default one. More info: EventRule -> SQS: you can use 
new aws.cloudwatch.EventTarget
 and it will emit a static JSON to the SQS queue. When I tried to do the same thing for Lambda, passing the Lambda ARN into 
aws.cloudwatch.EventTarget
 , the Lambda triggered is not created (presumably because EventSourceMapping is not created underneath). The only way to hook an 
EventRule
 to a Lambda is to call: 
EventRule.onEvent
. But that doesn’t let me configure the payload (code linked in the comment)
f
I’m not quite sure I understand what you’re trying to do. I didn’t think EventRules actually listened to the reply from a lambda invocation?
a
So EventRule -> SQS: you can use
new aws.cloudwatch.EventTarget
and it will emit a static JSON to the SQS queue. When I tried to do the same thing for Lambda, passing the Lambda ARN into
aws.cloudwatch.EventTarget
, the Lambda triggered is not created (presumably because EventSourceMapping is not created underneath). The only way to hook an
EventRule
to a Lambda is to call:
EventRule.onEvent
. But that doesn’t let me configure the payload: https://github.com/pulumi/pulumi-aws/blob/master/sdk/nodejs/cloudwatch/eventRuleMixins.ts#L129 This only lets me connect an EventRule to a Function and the payload will have this schema: https://github.com/pulumi/pulumi-aws/blob/master/sdk/nodejs/cloudwatch/eventRuleMixins.ts#L29