2

I have a piece of code, based on NodeJs, that does not serve any HTTP request, but monitors some online systems and sends report emails. This code is run by a shell script and keeps running 24x7.

Which Google Cloud offering is best suited to host this?

I tried with App Engine, but after one hour of console inactivity, the console exists and the script stops running.

I am not sure if Compute Engine would be best for this. I can host this in AWS EC2, it would work there... but wondering about Google.

Any tips appreciated.

Thanks

Felipe Caldas
  • 2,492
  • 3
  • 36
  • 55
  • You could do this with a CRON job in app engine. – new name May 24 '17 at 12:49
  • For long running tasks you want to use Compute Engine or a container in Kubernetes. Alternatively you could break your script up into smaller/quicker services and host each individually in Cloud Functions paired up with Cloud Tasks (Queueing system). If you have 1000 items to process you add them to the queue and Cloud Functions (Workers) pick up items from the queue and process the task. Otherwise, a compute engine instance will do the job just fine. – Ari Sep 14 '21 at 11:52

3 Answers3

2

The second version of Google Cloud Functions can run for up to 60 minutes (thanks to Google Cloud Run).

To sum up on GCP:

avimimoun
  • 799
  • 9
  • 23
1

This can be done with a simple Python app running in App Engine Standard Platform. See this post for details.

kpg
  • 7,644
  • 6
  • 34
  • 67
0

If you're able to modify it so it can run periodically you could run it on AWS Lambda with a schedule as trigger and use SES to send out e-mails.

Alternatively, if you have control over the "online systems", you could use CloudWatch custom metrics and create alerts based on the thresholds of your metrics.

If you must use Google Cloud, you could use Google Cloud Functions instead of AWS Lambda, and Google Cloud Monitoring / Logging.

Dennis
  • 779
  • 4
  • 14