0
votes

I have a dockerized plotly-Dash Flask app pushed to AWS Elastic Container Registry and running on the Elastic Container Service. It communicates fine with my RDS database on the same account.

Currently, data gets pulled from within the Flask app on every refresh of the page, but I would like to be able to trigger the Flask app to pull the data from RDS (once daily at possibly different times day to day, if that makes a difference).

The only way I've found so far is changing the structure so that it is only pulling the data once in the script before the Flask app is started, and then killing the task/restarting a new task every day. This shouldn't be the only way to do this and I'm sure someone here knows a much better way.

My hope would be this:

  1. Python script connects to MySQL db on RDS
  2. Pulls data to pandas df
  3. Uses data for Flask app
  4. I can trigger a new pull of the data without having to kill the task.
1
I would suggest to run corn job inside your container to schedule a script to pull the data from RDS.Asri Badlah
Thanks, that's interesting. Is there any way I can trigger it instead of scheduling it? Data updates don't happen at the same time every day.bandwagoner

1 Answers

0
votes

I think you can create a trigger on your DB table to call a lambda function which can trigger ECS. see the following example: here