1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Progress Blogs]

Discussão em 'Progress Blogs' iniciado por Thierry Ciot, Fevereiro 24, 2021.

  1. Thierry Ciot

    Thierry Ciot Guest

    On the Progress Corticon team, we love serverless technologies. This blog is the third in a series on serverless. If you are interested in AWS Lambda functions you can get started with this post on creating your first serverless/Lambda functions. Or if you are interested in Azure function you can get started with this post https://www.progress.com/blogs/how-to-create-your-first-serverless-functions-on-microsoft-azure

    Your first GCP Function


    If you do not have an account on GCP, you can simply create one for free. See https://cloud.google.com/free to get started.

    Once you are logged into your account, click on the navigation menu at the top left:

    [​IMG]

    And scroll down to the “Compute” section and click on “Cloud Functions.”

    [​IMG]


    Then click create and enter a function name.


    [​IMG]

    Click on “Save” and later click on “Next”. You will now be on the code screen.

    [​IMG]

    Click “Deploy.” This may take a while. Wait until you see the green checkmark as in the following screen.

    [​IMG]

    Once you get the green checkmark, click on the Actions and from the list that appears click on “Test Function.”

    [​IMG]

    This will lead to the following screen:

    [​IMG]

    Click on “TEST THE FUNCTION” button, and you will get the following result at the bottom of the screen:

    [​IMG]

    Congratulations, you have now run your first Google Cloud function. However, we didn't pass any data to the function. In the next section, we will learn how to use data from the input event.

    Click on “Test the Function” as we did earlier and enter a specific JSON payload like this:
    {

    "message": "this is my own data"

    }

    And click on run again. We will get:

    [​IMG]

    You should now look at the code and see how the sample accesses the message property and returns it as part of the result. Observe how the result is returned via the response object.

    Note how there is no way to save the JSON payload or create multiple test payloads as we can in AWS Lambda. This is a bit annoying and we hope Google will soon fix this.

    Congratulations, you have now run your first GCP function. As you can see it is very simple and you didn’t have to do anything to get a function that automatically scale based on the load and most importantly you did not need to provision and manage a set of servers to handle the load.

    Continue reading...

Compartilhe esta Página