I have an app on AWS using Elastic Beanstalk/RDS/EC2/etc.

The app has some database entries that need to be deleted after a certain time. I've tried to set up a cron task on the main server, but found that the web server cannot handle tasks like this, and a worker has to be created instead.

So, after writing up a quick worker based on this document, it seems that I cannot have the worker connect the existing database.

Am I overthinking this? I just need a way to have traffic come in, interact with the website, and then delete entries over time as they become irrelevant.

  • Why can't the webserver handle this? – ceejayoz Jul 28 '16 at 16:46
  • From what i've found, the webserver isn't able to run background tasks. (edit: at least, that's from my understanding of this page: docs.aws.amazon.com/elasticbeanstalk/latest/dg/…) – jfefes Jul 28 '16 at 17:00
  • The Worker approach is designed to address the issue of deciding which host should run a job when you have a cluster of application hosts (and how to autoscale the environment if the job consumes resources). An alternate, perhaps simpler, approach would be a scheduled lambda function that cleans up your data. See docs.aws.amazon.com/lambda/latest/dg/with-scheduled-events.html – jstell Aug 18 '16 at 17:13

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.