GCP 使用 Google Cloud Scheduler 自动关闭和启动

anX*_*ler 7 google-compute-engine google-cloud-platform google-cloud-scheduler

我想使用 Google Cloud Scheduler 在 Google Cloud Platform 中启动/停止一组计算引擎实例。我该怎么做?

Chr*_*s32 5

为了使用 Cloud Scheduler 启动和停止计算引擎,您可以按照谷歌本教程或其他

我不会在这里复制粘贴所需的代码,因为本教程非常完整,但我将在此处继续执行要遵循的步骤。

  1. 设置您的 Compute Engine 实例
  2. 部署启动云功能。你可以在这里看到一个例子
  3. 部署停止云功能。你可以在这里看到一个例子
  4. 设置 Cloud Scheduler 作业

如果您需要本教程的任何帮助,请告诉我!


小智 5

我直接使用vm实例API。不需要云功能。

以下是 api 描述的链接: https://cloud.google.com/compute/docs/reference/rest/v1/instances/stop

API 调用:POST https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instances/{resourceId}/stop

您可以用类似的方式启动发动机。

如何配置调度程序的示例:

在此输入图像描述