skip to Main Content

I am pretty new to AWS. We’re looking for a way to execute our node.js script like a cron job. There is Elastic Beanstalk application which runs a web server in node. In the same git repository, we’ll have a few lightweight services that will run periodically, probably one minute, to clean something from DB, sync some external data etc, nothing major.

What would be the best way to do this?
I would like to avoid using lambda, since we want the code to be locally testable and present in the repository.

Thanks in advance

2

Answers


  1. Any service that can be subscribed to scheduled CloudWatch events.

    If you don’t want to use Lambda, you could use ECS/Fargate to run scheduled tasks. The short version is it’s basically docker run on a cron schedule made easy.

    Login or Signup to reply.
  2. You could do it using following steps:

    1. Expose some public secure end-points (web-hook endpoints) to perform the intended job.
    2. Create an EventBridge Rule to invoke those Http Endpoints on a scheduled basis using some CRON Expression.

    Note: Don’t expose those public endpoints without any authorization.

    Here is an screenshot of EventBridge from AWS Console.

    enter image description here

    Reference – Using API destinations with Amazon EventBridge

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search