skip to Main Content

I am trying to achieve these:

  • deploy a spring-boot application on AWS, which does something, say,
    print the current system time; and
  • the application runs as a cron-job on AWS, for example, every 1st day of a month; and
  • no endpoint (URL) is exposed by the application.

How to implement that? Any code snippets or guidance will be highly appreciated.

(I searched the web and the solutions are mostly to create a lambda or set the target of the cron-job to be an endpoint. But none of them is what I want.)

Thanks in advance!

2

Answers


  1. You can schedule an event using Event Bridge Scheduler but that should have an (internal) service endpoint as a target. (Not sure from your question why that is a problem.)

    Alternatively, you can always spin up an EC2 instance, deploy your application on it, and then set up a crontab -e on it. Will be more expensive, but will have no endpoint.

    Combining the two, you could schedule an EventBridge event that will kick off a lambda that will kick off a CloudFormation deployment to spin up an EC2 instance with your application, which on completion will kick off a lambda to tear down the CloudFormation stack and terminate your instance so that you have to pay for EC2 only while it is running.

    Hope this helps.

    Login or Signup to reply.
  2. You can use Eventbridge to schedule a cron & then for target choose the service on which you have deployed the your application

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