This page gives you an overview of how to deploy a Cloud Function from the
Google Cloud Functions API. Similar to the
gcloud command-line tool, which
Cloud Functions API, you can use the API
directly to manage Google Cloud Functions. Sample use cases include deploying
large amounts of functions or deploying custom functions on behalf of an
To create a Cloud Function using the Cloud Functions API, do the following in your application:
- Create a
- Upload a zip archive at the signed URL.
- Create a Cloud Function.
First call the API method
to create an
This URL is a generated Google Cloud Storage signed URL that should be used for the function source code upload. The uploaded file should be a zip archive that contains your function.
Upload a Zip Archive at the Signed URL
Zip the contents of the Cloud Function source code. Upload the zip file to Cloud Storage via a signed URL.
See Resumable Uploads to learn how to upload a file to a Cloud Storage signed URL.
Create a Cloud Function
Finally, to create a Cloud Function use the projects.locations.functions.create
in a client library, making sure to provide necessary fields such as the
The project gcx uses the Cloud Functions API in Node to programmatically create and call Cloud Functions, either as a CLI or API. This tool not only shows an example of using the Cloud Functions API, but you can use it as a convenient way to automate the deployment of Google Cloud Functions.