We will now create a cloud function through the GCP console:
- Go to the Cloud Functions overview page in the GCP console, select the project from the drop-down list for which the function is attached.
- Click on Create Function.
- Name the function as my-serverless-function.
- Select the trigger as an HTTP trigger.
- Let's use the default code, so it should be checked by an inline editor. The text area will have two scripts, one is index.js and the other is package.json. This is a simple helloworld function provided by Google Functions. The function logs a message which you provide in a later step. When you finish the steps you will see something similar to the following screenshot:

- Click on the Create button. Now the function will be deployed and the GCP console redirects to the Overview page. While the function is being deployed, the icon next to it is a small spinner. After deployment is complete, the spinner turns to a green check mark.
- We will test the function. Click on the three vertical dots on the right-hand side of the page for the particular function and click on the Test function:

- We will be redirected to a function test page. In the Triggered Event field, replace the text with {"message":"Hello World!"} and click on Test function. In the Output field we should see the Success: Hello World!. and in the Logs field the status code 200 will indicate that the function ran successfully. We can see detailed logs by clicking on the arrow for each log.
- We can see the logs history by click on VIEW LOGS on top right. So, this is how we create and deploy the function through the GCP console and also view the function logs and their history:
