This Github repository is a boilerplate of a simple Python script called repeatably in a Docker container.
Recently I’ve deployed one of my home projects to ECS (AWS Elastic Container Service) using this approach and it worked seamlessly for over 3 weeks so I decided it’s time to share it. My use case was I needed to fetch some data every minute from a third party API and then send the data over to Kinesis. Google Functions combined with Google AppEngine is obviously one of the approaches (https://cloud.google.com/solutions/reliable-task-scheduling-compute-engine) but I think this approach using Docker is probably equally straightforward or even simpler.
The idea is very simple and it’s basically calling a Python script using a fixed interval in a bash script. The reason for using a shell script is that it’s not limited to just Python, but anything can be executed from the command line.
OK, give it a try and let me know how you get on with it 🙂