Creating your first Google Cloud Functions V2 | Scribe

    Creating your first Google Cloud Functions V2

    • Hafeez Baig |
    • 32 steps |
    • 6 minutes
    1
    Sign in to the **Google Cloud Console**
    2
    Type "**Cloud Functions"** in the search bar and click on the **Cloud Functions** option
    information ordinal icon
    **What are Cloud Functions?**\ \ Cloud Functions is a serverless execution environment offered by cloud providers, such as Google Cloud, which allows you to run code in response to events without managing servers. It automatically scales, handles infrastructure management, and charges based on the actual compute time used, making it ideal for lightweight, event-driven applications.
    3
    Click on the **CREATE FUNCTION** button on the top left side
    4
    **Enable required APIs** wizard will open, click on the **ENABLE** button
    5
    **Cloud Functions** wizard will open, on the **Environment** dropdown select the option **1st gen**
    6
    Scroll to the **Function name** and type "**my-first-cloud-function"**
    7
    Scroll to the **Trigger type** dropdown section and select the option **HTTP**
    information ordinal icon
    **What is Trigger type HTTP?**\ \ The HTTP trigger type in Cloud Functions allows you to invoke a function via an HTTP(S) request. This means the function can be executed by sending an HTTP request to a specific URL, making it suitable for creating webhooks, APIs, and handling web requests.
    8
    Scroll to the **Authentication** section and select the option **Allow unauthenticated invocations**
    information ordinal icon
    **What is the Allow unauthenticated invocations option?**\ \ The **Allow unauthenticated invocations** option allows anyone to invoke your Cloud Function without requiring authentication. This means that the function can be accessed publicly over the internet without any form of identity verification.
    9
    Scroll the page and untick the check box **Require HTTPS** and click on the **SAVE** button
    10
    Scroll to the **HTTP** wizard under **Trigger** section, check all the configurations and click on the **NEXT** button
    11
    **Create a function** wizard will open, on the **Runtime** dropdown select the option **Node.js 20** or whichever is the latest Nodejs version
    12
    Scroll the page and click on the **DEPLOY** button
    13
    On the top right corner click on the **Notifications** icon, then click on the **Deploying Cloud Function "my-first-cloud-function"**
    information ordinal icon
    Congratulations! you have successfully Deployed a Cloud Function
    14
    On the Cloud Functions wizard click on the Name **my-first-cloud-function**
    15
    **my-first-cloud-function** wizard will open, click on the **METRICS** tab to view all the Metrics details
    information ordinal icon
    **What are METRICS?**\ \ Metrics are quantitative measurements used to assess, monitor, and track the performance, behavior, and health of systems, applications, and processes. In IT and cloud environments, metrics can include data points like CPU usage, memory consumption, request latency, error rates, and throughput, providing valuable insights for optimization and troubleshooting.