Creating your first Google Cloud function
Google Cloud Functions is a serverless execution environment for building and connecting cloud services. You can write simple, single-purpose functions that are attached to events emitted from your cloud infrastructure and services. Your function is triggered when an event being watched is fired.
Navigate to the Google Cloud Function page in your cloud account in the region of your
Click CREATE FUNCTION.
You can now create your function.
- Give your function a meaningful name for your use case.
- Select the region where your function should be running.
- Select the trigger that you want to use with your function and configure it.
- Click SAVE.
- Expand the Runtime, build, connections and security settings section.
Configure Memory allocation and Timeout
on the Runtime tab.
For more information on recommendations, see the Memory and timeout in runtime configuration section in Configuring your Google Cloud function.
Select a Runtime service account.
For more information, see Service account.
- Configure the Runtime environment variables. For more information, see the Runtime environment variables section in Configuring your Google Cloud function.
You may also want to switch to the Security tab and reference a
secret for sensitive parameters.
For more information on a secure mechanism for storing parameters, see the Google Cloud Secret Manager section in Parameters.
- Click NEXT.
In the Code section, select Java 11 for the
If it is not already enabled, you have to enable the Cloud Build API.
In the Source code drop-down menu, select ZIP
Upload and upload the ZIP file that was provided to you by Cloudera.
Provide a Google Cloud Storage Stage bucket where the code will be staged during the deployment of the function. Alternatively, you may choose ZIP from Cloud Storage and provide a location to the ZIP file.
Set the Entry point to:
- For HTTP triggers:
- For background triggers with asynchronous calls:
Once your function is deployed, it looks similar to this: