Is there a way to schedule Cloud Shell commands in Google Cloud Platform?

Viewed 1647

I want to schedule some of my BigQuery table load commands that I execute in the Cloud Shell CLI. How can I schedule my CLI commands in Google Cloud Platform?

2 Answers
  1. Use Cloud Scheduler to shell jobs, like a HTTP trigger.
  2. Create a Cloud Run container running the commands you want on HTTP trigger. Here is an example.

This solution is serverless, only runs when it's triggered. Cloud Run allows 2M request for free. Cloud Scheduler allows 3 jobs per month per account free, then Cost/job/month $0.10.

Cloud Shell isn't a tool intended to use as part of your production environment, you should take a look into it's terms and conditions. you might find this part especially blocking for this purpose:

Non-interactive sessions will be ended automatically after a warning. Note that Cloud Shell sessions are capped at 12 hours, after which sessions are automatically terminated.

What you can actually do is to create a Cloud Function and trigger it by a cron job or use a Compute Engine instance and schedule a command on linux

Related