Search code examples
pythonruntimegcloudapp.yaml

gcloud app.yaml Python setting for resources


How could we set resources for Python runtime inside app.yaml? The below gives me an error when it reaches to resources section. however, If I chose nodejs14 as runtime it works

runtime: python27
api_version: 1
threadsafe: true

manual_scaling:
  instances: 1
resources:
  cpu: 1
  memory_gb: 0.5
  disk_size_gb: 1
env_variables:
  NODE_ENV: 'production'

Solution

  • There are 2 flavors of App Engine: standard; flex

    Using standard there is no resource section in app.yaml because the resources are determined by the instance type.

    https://cloud.google.com/appengine/docs/standard/nodejs/config/appref

    Using flex, resources section is used to determine the (Compute Engine) VM type.

    https://cloud.google.com/appengine/docs/flexible/python/reference/app-yaml#resource-settings

    If you wish to use standard and specify resources, you'll need to specify the instance type:

    https://cloud.google.com/appengine/docs/standard#instance_classes

    If your wish to use flex, you can specify the CPU and memory using the resources section.