I am trying to trigger a Lambda function when a RequestCertificate
event is being raised in AWS Certificate Manager.
In order to do that, I have created a CloudWatch Rule with the following syntax:
{
"source": [
"aws.acm"
],
"detail-type": [
"AWS API Call via CloudTrail"
],
"detail": {
"eventSource": [
"acm.amazonaws.com"
],
"eventName": [
"RequestCertificate"
]
}
}
This rule has a Lambda function as the target. I've made sure that the Lambda function has all the permissions it needs to execute correctly.
However, when I request a certificate on ACM, the Lambda is not triggered at all, even though the RequestCertificate
event appeared in CloudTrail Event history.
To resolve this, I had to create a Trail that will store CloudTrail logs in an S3 bucket. Once this is done, the Lambda now gets triggered correctly.
The thing is, this is not specified on the documentation here: Creating a CloudWatch Events Rule That Triggers on an AWS API Call Using AWS CloudTrail
So, I would like to know if this is the expected behavior, or if there was something wrong in the first place with my CloudWatch Rule.
Thanks.