Playing with Cloud Functions - Gen 2 | Scribe

    Playing with Cloud Functions - Gen 2

    • Hafeez Baig |
    • 30 steps |
    • 3 minutes
    1
    Sign in into the **Google Cloud Platform**
    2
    Type **Cloud Functions** in the search bar and click on the **Cloud Functions** option.
    information ordinal icon
    **What are Cloud Functions?**\ \ **Cloud Functions** are a serverless compute service that allows you to run code in response to events without managing servers. You write your code, deploy it, and Cloud Functions automatically handles scaling, infrastructure management, and execution. They are ideal for lightweight, event-driven tasks like handling HTTP requests, processing data, or responding to changes in cloud storage.
    3
    **Cloud Functions** wizard will open, click on the **CREATE FUNCTION** button ON THE TOP LEFT SIDE
    4
    **Enable required APIs** wizard will open, click on the **ENABLE** button
    5
    **Create function** wizard will open, scroll to the **Environment** dropdown and select the option **2nd gen**
    6
    Scroll to the **Function name** and type "**my-second-generation-cloud-function**"
    7
    Scroll to the **Authentication** section and select the **Allow unauthenticated invocations** radio button
    information ordinal icon
    **What is the Allow unauthenticated invocations option in Authentication?**\ \ The **Allow unauthenticated invocations** option in **Authentication** enables public access to your Cloud Function, meaning that it can be invoked by anyone without requiring authentication. This is useful for publicly accessible functions like webhooks or APIs but may expose the function to unauthorized use if not properly secured.
    8
    Click on the **NEXT** button
    9
    **Code** wizard will open, on the **Runtime** section and select the option **Node.js 20** or whichever is the latest version
    10
    Scroll the page and click on the **DEPLOY** button **Note:** The deployment will take some time.
    11
    **my-second-generation-cloud-function** wizard will open, here you can view all the Function details
    12
    Click on the copy widget to copy the **URL** on the right side
    13
    Open a new tab in any browser and paste the copied URL
    14
    **Hello World!** is displayed
    information ordinal icon
    Congratulations on succesfully deploying a Cloud Function
    15
    Go back to the **Cloud Function** wizard
    16
    Click on the **SOURCE** tab
    17
    Click on the **Edit** button to edit the Cloud Function