Quickstart: Using the Console

This page shows you how to create and deploy a Cloud Function written with Node.js, Python, or Go using the Cloud Console.

For a more detailed discussion of how to create and deploy a function in Cloud Console, see Deploying from Cloud Console.

Before you begin

  1. Sign in to your Google Account.

    If you don't already have one, sign up for a new account.

  2. In the Cloud Console, on the project selector page, select or create a Google Cloud project.

    Go to the project selector page

  3. Make sure that billing is enabled for your Google Cloud project. Learn how to confirm billing is enabled for your project.

  4. Enable the Cloud Functions API.

    Enable the API

Create a function

  1. Open the Functions Overview page in the Cloud Console:

    Go to the Cloud Functions Overview page

    Make sure that the project for which you enabled Cloud Functions is selected.

  2. Click Create function.

  3. Name your function.

  4. In the Trigger field, select HTTP Trigger.

  5. In the Source code field, select Inline editor. In this exercise, you will use the default function provided in the editor. The function logs a message that you provide in a later step.

  6. Use the Runtime dropdown to select a runtime.

When you finish these steps, your display should resemble the following, depending on which runtime you selected:

Screenshot showing function creation form for Python

Deploy a function

Deploy the function:

  1. At the bottom of the page, click Create.

  2. After clicking Create, Cloud Console redirects to the Cloud Functions Overview page.

    While the function is being deployed, the icon next to it is a small spinner. After it finishes deploying, the spinner turns to a green check mark:

    Screenshot that shows function deployment process

Test the function

To test the default function provided in the Cloud Console inline editor:

  1. Display the menu for your function, and click Test function.

    Screenshot that shows function testing process

  2. In the Triggering Event field, enter the text {"message":"Hello World!"}, and click Test the function.

    In the Output field, you should see the message Success: Hello World!.

    In the Logs field, a status code of 200 indicates success.

    Screenshot showing Logs field with 200 code, indicating success

View logs

Check the logs to see your actions in the log history:

  • Back on the Cloud Functions Overview page, display the menu for your function, and click View logs.

Your log history appears.

Screenshot showing Logs field with 200 code, indicating success

What's next

Var denne siden nyttig? Si fra hva du synes:

Send tilbakemelding om ...

Cloud Functions Documentation