I'm looking for an easy way to run a Python script that makes API calls every minute, 24/7, and to save the results. I've played around with AWS Lambda, but dealing with boto3 for S3, setting up a VPC for connectivity, and navigating the new tools has been frustrating. I already have a Python script that works fine on my local machine, but I don't want to rely on my laptop being on all the time, especially since I'm working with transit vehicle tracking data that I need to keep consistent. I've signed up for PythonAnywhere but am wondering if I'm missing something that could simplify this. What's the quickest approach to:
* Ensure my Python script runs 24/7 without dependency on my computer
* Access the internet for API calls
* Save the API results efficiently?
Is there a simpler setup with AWS Lambda that I'm overlooking, or is there a straightforward tutorial or another service that's easier?
5 Answers
How are you planning to retrieve and store the data once you’ve saved it? That part can vary based on what services you choose.
You might want to consider using a Raspberry Pi, especially a model 3B+ or newer. They're great for running scripts continuously and are super cheap. Plus, you won’t have to deal with any cloud services that can be a bit of a hassle.
Yep! I've got a Raspberry Pi that's been running my bots non-stop for a couple of years now. It's definitely a solid option.
Getting a cheap VPS is another alternative. Services like Lightnode offer hourly billing, so you can run your scripts without any long-term commitment, and it's pretty easy to set up.
If you’re looking for a cloud option, spinning up an EC2 instance might be your best bet. Just upload your Python script there, and you can run it directly. It's straightforward: SSH in, run it in a `screen` or `tmux` session to keep it alive, or use a systemd unit file to start it automatically on boot. You'll have full control over the environment.
A VPS could simplify things significantly for you. It's relatively low cost and gives you the flexibility to run any applications you need, like Python or Docker.

Totally agree! I've been running a few Raspberry Pis at home for over a year now, and they just keep on going without any issues.