0

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.

asked Oct 10, 2022 at 11:42
2

1 Answer 1

0

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.

answered Oct 10, 2022 at 14:44
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.