Question

Difficulty: EasyDeploying Serverless Applications with Cloud Run and Cloud Functions

A developer wants to deploy an HTTP-triggered serverless function written in Python directly from source code using the Google Cloud CLI. Which gcloud command should the developer execute to perform this deployment?

  1. gcloud functions deploy FUNCTION_NAME --runtime=python311 --trigger-httpAnswer
  2. B
    gcloud run deploy FUNCTION_NAME --image=python311 --trigger-http
  3. C
    gcloud compute instances create FUNCTION_NAME --runtime=python311
  4. D
    gcloud serverless deploy FUNCTION_NAME --runtime=python311

Answer

The command 'gcloud functions deploy FUNCTION_NAME --runtime=python311 --trigger-http' correctly deploys a Python function with an HTTP endpoint using the Cloud SDK.
The correct command 'gcloud functions deploy FUNCTION_NAME --runtime=python311 --trigger-http' specifies the correct command group ('functions'), action ('deploy'), function name, runtime environment, and HTTP trigger flag required for deploying a serverless Cloud Function.

Step-by-Step Solution

1
Identify the target serverless product
The requirement specifies deploying function source code as a Cloud Function, which corresponds to the 'gcloud functions' command group.
Choosing the appropriate command group is essential for invoking the correct service API.
2
Specify the required deployment parameters
Set the function name, runtime environment ('--runtime=python311'), and invocation type ('--trigger-http').
Cloud Functions deployments require specifying the execution runtime and how the function is triggered.

Key Concept

Deploying Cloud Functions via gcloud CLI
Estimated Time:45s
Rate this question