Search code examples
amazon-web-servicesaws-lambdascheduled-tasksaws-event-bridgeamazon-cloudwatch-events

How to configure EventBridge Scheduled Rule to trigger my Lambda function dynamically?


I need help about a subject. (I'm using AWS)

I'm trying to use live activity of ios in my application. I realize that I have to update live activity variable on server side while application is closed on user phone. --> docs

I need that update some variables on live activity of user after than 4 hours of user action. I mean that scenario:

  • User make an action on app and an endpoint called.
  • After 4 hours, some variable should change on live activity.

I create this solution:

  • When user call api, I can create an scheduled event on EventBridge. This event trigger lambda function after 4 hours.
  • Lambda function will update live activity

But I can not scheduled event of EventBridge dynamically. While I try to create rule on default eventbus, I can choose Scheduled rule type. But I can set only specific time with cron expression.

Events have not schedule feature. Rules have that feature. So I tried create rule and send event to rule on my api. But I can not set target (lambda func) on code.

I think that I'm missing something and lost way.

Do you have any idea about solve this issue?

Thanks a lot


Solution

  • If my description is bad, I'm sorry for this..

    I solved this issue.

    EventBridge is not suit for my needs, I used EventBridge-Scheduler (new/last part of tool)

    You can find differences here (aws document): https://aws.amazon.com/tr/blogs/compute/introducing-amazon-eventbridge-scheduler/

    Scheduler part has one-time schedule option, deleted after event trigger option,'time window schedules' and specified for exact date time.

    The Scheduler is more suit for my needs.