5

I'm retrieving a list of rules from AWS EventBridge using the SDK in the following way:

var response = await ebClient.ListRulesAsync(rulesRequest, cancellationToken);
var rules = response.Rules;

Each rule in the list have Name, ScheduleExpression, etc. but not information such as last execution time or next execution time for that matter. I thought this information would be available or obtained in some other way through the SDK but can't figure it out. Is this possible?

Thanks in advance!

dcg
  • 4,187
  • 1
  • 18
  • 32

1 Answers1

0

AWS EventBridge doesn't provide information about the last/next execution time. The only way you can extract that information is from the metrics but I wouldn't recommend that either since there is often a delay in the metrics being published.

A simple alternative I found was to use the target of the rule to extract this information. Lets say your target is a lambda function :- use the target(lambda func) to tag the rule with the last invocation time of the lambda.

Alternate to this is to add an SNS to the targets of the scheduled rule. The sns goes out every time the rule's executed and you can use that timestamp to get the last execution time. Add the Event schedule(eg :25 min) and you have the next execution time.

From my perspective tagging the rule is the easiest and simplest way to go without creating an unnecessary overhead

[I had also checked with the AWS support and they confirmed that Eventbridge doesn't have this feature as of now so such workarounds are necessary.]