Im attempting to process cloudwatch events, specifically cloudtrail ones since I am deploying into us-east-1 but would like to get events from all regions. Everything deploys, but the events are not triggering the lambda.
My cloudtrail is configured for all regions and delivering to a Cloudwatch Log Group.
functions:
ec2_instance_region_watch:
handler: ec2_instance_region_watch.ec2_instance_region_watch
events:
- cloudwatchEvent:
event:
source:
- “ec2.amazonaws.com”
detail-type:
- “AWS API Call via CloudTrail”
detail:
eventName:
- “RunInstances”
My cloudwatch event is created.
{
“detail-type”: [
“AWS API Call via CloudTrail”
],
“source”: [
“ec2.amazonaws.com”
],
“detail”: {
“eventName”: [
“RunInstances”
]
}
}
I launch an instance, and in the cloudwatch log group I get an event that contains what I expect.
"eventSource": "ec2.amazonaws.com",
"eventName": "RunInstances",
but the lambda is never triggered. I was trying to somewhat dupe this, https://serverless.com/blog/serverless-cloudtrail-cloudwatch-events/