Skip to content

Latest commit

History

History
73 lines (54 loc) 路 4.01 KB

File metadata and controls

73 lines (54 loc) 路 4.01 KB

GCP - Cloud Functions

This document explains how to create a project on GCP and where to find products to deploy your backend (Cloud Run and/or Cloud Functions)

Table of Contents
  1. About
  2. Getting Started
  3. Creating a server function
  4. Server function settings
  5. Testing the function
  6. Resources

Getting Started

  1. Create an account on Google Cloud Platform.
    NOTE: if you are using your private account and insert your card details, GCP has a free trail that gives $300 credits and free tier, which means you have a free usage of different services within certain limits.

For Cloud Functions the limit is 2 million calls* 馃檭

  1. Look at the website:
    gcp web interface

(back to top)

Creating a server function

  1. On GCP all resources should be collected under a project - think about it as a folder that has all the things related to one project (images, files, functions etc). Create a new project: gcp web interface

  2. Give your project a name (e.g. thesis) and choose an organization (can be No organization as well). Click on Create project.

  3. When the project is created you get a notification: gcp_project_create_success

  4. Go to the menu on the left side. There is an extremely long list of all the different GCP products and services. Click on View all products to expand it even more and choose Cloud Run. You find it under the section Serverless. You can pin this product - it will be more comfortable accessing it later. gcp_cloud functions menu

  5. In the project you have two options:

    • deploying a container (use when you have several endpoints)
    • write a function (use when you have a single endpoint)

gcp_gcr_ui

NOTE: it will be unclickable if you don't have a payment method connected to it. You would need to link a card to it - but you should not be charged unless you go over the free limit. For this click on Billing on the left side.
ANOTHER NOTE: New users receive $300 credits to use on GCP for 3 months (which is quite a lot). You could activate them instead.

(back to top)

Deployment

You can deploy your server directly from visual code:

Note: for testing purposes you can leave unauthenticated invocations (can be called by anyone), but it is recommended to use authentication for protection. Make sure you control your spending and delete the unused resources.

Resources

(back to top)