Reputation: 301
I have an ECS task and I want to trigger a Lambda function once ECS task stopped. I created an event rule like below
{
"source": ["aws.ecs"],
"detail-type": ["ECS Task State Change"],
"detail": {
"clusterArn": ["arn:aws:ecs:region:account:cluster/mycluster"],
"taskDefinitionArn": ["arn:aws:ecs:region:account:task-definition/mytaskdefinition:revisionNumber"],
"lastStatus": ["STOPPED"]
}
}
This rule worked perfect when I used Default event bus, but as soon as I moved this event rule to a Custom Event bus, no events coming to that rule.
Upvotes: 0
Views: 1091
Reputation: 11588
AWS Events are emitted only to the default event bus. If you want to have them in a different event bus that you created, you need to create a Rule that forwards them there.
You would do this by creating a Rule
in your default event bus and use events_targets.EventBus
as the target to forward them to your custom event bus.
After you do this, you can create rules in the custom event bus to handle the events being forwarded there.
Upvotes: 0