admin管理员组文章数量:1333476
I am trying to trigger an event bridge rule:
{
"detail": {
"stateMachineArn": ["arn:aws:states:eu-west-2:<account-num>:stateMachine:<target-name>"],
"status": ["SUCCEEDED"]
},
"detail-type": ["detail-type"],
"source": ["aws.states"]
}
I'm trying to put an event to the default bus using the following step in my step-function:
"SendEventToEventBridge": {
"Type": "Task",
"Resource": "arn:aws:states:::events:putEvents",
"Parameters": {
"Entries": [
{
"Source": "aws.states",
"DetailType": "detail-type",
"Detail.$": "$.event",
"EventBusName": "default"
}
]
},
"End": true
}
But I keep getting a NotAuthorizedForSourceException when trying to upload this event in my step function using source 'aws.states'. From what I can tell it's because only AWS Service events can use sources 'aws.'. I thought sending an event from the step function as such would satisfy this condition but it seems not to. I'm struggling to understand, how do I send and event to the bus with the required source of 'aws.states' to satisfy the rule?
I am trying to trigger an event bridge rule:
{
"detail": {
"stateMachineArn": ["arn:aws:states:eu-west-2:<account-num>:stateMachine:<target-name>"],
"status": ["SUCCEEDED"]
},
"detail-type": ["detail-type"],
"source": ["aws.states"]
}
I'm trying to put an event to the default bus using the following step in my step-function:
"SendEventToEventBridge": {
"Type": "Task",
"Resource": "arn:aws:states:::events:putEvents",
"Parameters": {
"Entries": [
{
"Source": "aws.states",
"DetailType": "detail-type",
"Detail.$": "$.event",
"EventBusName": "default"
}
]
},
"End": true
}
But I keep getting a NotAuthorizedForSourceException when trying to upload this event in my step function using source 'aws.states'. From what I can tell it's because only AWS Service events can use sources 'aws.'. I thought sending an event from the step function as such would satisfy this condition but it seems not to. I'm struggling to understand, how do I send and event to the bus with the required source of 'aws.states' to satisfy the rule?
Share Improve this question asked Nov 20, 2024 at 17:20 Nyle AllissNyle Alliss 4711 bronze badges1 Answer
Reset to default 1The error you’re encountering (NotAuthorizedForSourceException) is due to the fact that the Source field in an EventBridge event must reflect the actual service that is authorized to publish events under that namespace. In your case, aws.states is reserved for AWS Step Functions when it emits its own events (such as ExecutionStarted or ExecutionSucceeded), not for custom events you send through your Step Function.
Instead of using aws.states for your custom event, choose a unique namespace for the Source. For example, use something like my-application or custom.states:
"SendEventToEventBridge": {
"Type": "Task",
"Resource": "arn:aws:states:::events:putEvents",
"Parameters": {
"Entries": [
{
"Source": "custom.states",
"DetailType": "detail-type",
"Detail.$": "$.event",
"EventBusName": "default"
}
]
},
"End": true
}
Updated EventBridge Rule
{
"detail": {
"stateMachineArn": ["arn:aws:states:eu-west-2:<account-num>:stateMachine:<target-name>"],
"status": ["SUCCEEDED"]
},
"detail-type": ["detail-type"],
"source": ["custom.states"]
}
本文标签: amazon web servicesHow to create event bus events with source 39aws39Stack Overflow
版权声明:本文标题:amazon web services - How to create event bus events with source 'aws.'? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742341542a2456701.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论