I want to make sure that my lambda triggers only when a particular ssm document status is Success, so i have written the following eventbridge pattern but it is not working.
I want to make sure that my lambda triggers only when a particular ssm document status is Success, so i have written the following eventbridge pattern but it is not working.
"source": ["aws.ssm"],
"detail-type": ["EC2 Command Status-change Notification"],
"detail": {
"documentName": ["MyDocument"],
"status": ["Success"]
But when i remove the document name it is properly triggering my lambda, i would like to know how could we make sure that only if this particular document is success it has to trigger my lambda.
2
Answers
It seems there is a typo in the document’s name key.
It has to be "document-name" instead of "documentName".
Can you try the following:
Sample event taken from AWS EventBridge:
The issue is likely with how you’re specifying the documentName. SSM events use document-name instead of documentName. Try this pattern:
A few things to double-check:
If it’s still not working, you might want to use the "Test pattern" feature in the EventBridge console. This lets you paste in a sample event and see if your pattern matches.
Also, consider using
"status": ["Success", "CompletedWithSuccess"]
to catch both possible success statuses.If you’re still having trouble, share a sample of the raw event from CloudWatch Logs, and we can help you craft the exact pattern you need.