In a nutshell this is what I'm trying to achieve: I want the data analysts to always include a particular lifecycle configuration when they create a notebook instance on SageMaker.
I intend to use SageMaker's CreateNotebookInstance calls to trigger a lambda that will delete notebook instances that does not meet the above criteria.
I've created an event bridge that supposed to trigger the lamba. But it's not working, the lambda is not being triggered when i create a notebook instance, i check CloudWatch Logs for the Lambda but noting after creating a not book. is anything wrong with my event pattern?
{
"source": ["aws.sagemaker"],
"detail-type": ["AWS API Call via CloudTrail"],
"account": ["123456789012"],
"region": ["us-east-1"],
"time": ["2021-04-29T01:29:59Z"],
"detail": {
"eventSource": ["sagemaker.amazonaws.com"],
"eventName": ["CreateNotebookInstance"]
}
}
The account id I put there is just a placeholder for the post, i put the actual account id in the pattern. I've removed the time key but still didn't work
Can you verify that the Lambda resource-based policy allows the rule to Invoke the Lambda? If viewing the Lambda in the AWS console, the resource policy can be seen by selecting the Configuration tab, then Permissions on the left hand side. Scrolling below the Execution role is a section Resource-based policy statements.