英文:
Trigger lambda function on CreateSecret event on secrets manager
问题
我有一个 Lambda 函数,我只想在 Secrets Manager 创建或更新时触发它。我正在尝试创建一个 EventBridge 规则,以在 Secrets Manager 上的任何操作上触发 Lambda。但是 EventBridge 规则也没有触发。我没有明确创建任何 CloudTrail 跟踪,但我可以在 CloudTrail 的事件历史记录中看到 Secrets Manager 操作的日志。
我尝试使用以下事件模式创建规则:
{
"source": ["aws.secretsmanager"],
"detail-type": ["AWS API Call via CloudTrail"],
"detail": {
"eventSource": ["secretsmanager.amazonaws.com"],
"eventName": ["CreateSecret", "PutSecretValue", "UpdateSecret"]
}
}
英文:
I have one lambda function which I want to trigger only when secrets managers is created or updated. I am trying to create a eventbridge rule to trigger lambda on any operations on secrets manager. But eventbridge rule is also not triggering. I don't have any cloudtrail trail created explicitly but I can see the logs of secrets manager operations in the event history of cloudtrail
I tried creating a rule using below event pattern
{
"source": ["aws.secretsmanager"],
"detail-type": ["AWS API Call via CloudTrail"],
"detail": {
"eventSource": ["secretsmanager.amazonaws.com"],
"eventName": ["CreateSecret", "PutSecretValue", "UpdateSecret"],
}
}
答案1
得分: 1
在使用您的模式重新创建规则时,我意识到JSON格式是无效的。尝试使用以下格式,这对我有效:
{
"source": ["aws.secretsmanager"],
"detail-type": ["AWS API Call via CloudTrail"],
"detail": {
"eventSource": ["secretsmanager.amazonaws.com"],
"eventName": ["CreateSecret", "PutSecretValue", "UpdateSecret"]
}
}
英文:
While recreating a rule using your pattern I realized that the JSON is invalid. Try this one, it works for me:
{
"source": ["aws.secretsmanager"],
"detail-type": ["AWS API Call via CloudTrail"],
"detail": {
"eventSource": ["secretsmanager.amazonaws.com"],
"eventName": ["CreateSecret", "PutSecretValue", "UpdateSecret"]
}
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论