【问题标题】:Disable App Engine Instance/Server during hours to reduce costs在数小时内禁用 App Engine 实例/服务器以降低成本
【发布时间】:2019-08-12 00:55:35
【问题描述】:

我希望在夜间关闭在谷歌应用引擎上运行的节点服务器以降低服务器成本并在早上重新启动它。晚上 11 点 - 上午 11 点。

有没有办法通过在服务器本身上运行一个函数来关闭应用引擎?

然后我会通过外部服务器运行另一个函数来重新启动服务器/实例。

【问题讨论】:

    标签: node.js google-app-engine google-cloud-platform gcloud


    【解决方案1】:

    要启用或禁用您的 App Engine 应用程序,您可以使用 App Engine Admin API 中的 apps.patch method

    你必须使用这些参数:

    路径参数:

    name = apps/[project-id]
    

    查询参数:

    updateMask = servingStatus
    

    请求正文:

    启用您的应用程序:

    {
      "servingStatus": "SERVING"
    }
    

    要禁用您的应用程序:

    {
      "servingStatus": "USER_DISABLED"
    }
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-02-06
    • 1970-01-01
    • 1970-01-01
    • 2011-05-09
    • 2018-03-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多