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.

Follow these steps to create a Google Cloud function that is able to run DataFlow Functions:
  1. Navigate to the Google Cloud Function page in your cloud account in the region of your choice.
  2. Click CREATE FUNCTION.
    You can now create your function.
    1. Give your function a meaningful name for your use case.
    2. Select the region where your function should be running.
    3. Select the trigger that you want to use with your function and configure it.
  3. Click SAVE.
  4. Expand the Runtime, build, connections and security settings section.
  5. 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.
  6. Select a Runtime service account.
    For more information, see Service account.
  7. Configure the Runtime environment variables. For more information, see the Runtime environment variables section in Configuring your Google Cloud function.
  8. Optional: 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.
  9. Click NEXT.
  10. In the Code section, select Java 11 for the Runtime.
    If it is not already enabled, you have to enable the Cloud Build API.
  11. 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.
  12. Set the Entry point to:
    For HTTP triggers:
    com.cloudera.naaf.gcp.cloud.functions.StatelessNiFiHttpFunction
    For background triggers with asynchronous calls:
    com.cloudera.naaf.gcp.cloud.functions.StatelessNiFiBackgroundFunction
  13. Click DEPLOY.

    Once your function is deployed, it looks similar to this: