SageMaker to Trigger Lambda

0

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"]
  }
}
1 Answer
1

If the above is an exact copy of your event pattern, some possible issues are a) the account was left at a default example value, and b) you did not intend to filter only for events at a particular time and so the time key should be removed.

AWS
answered 6 months ago
  • 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.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions