Google Cloud Functions is a serverless, event-driven computing service within Google Cloud Platform. Developers can use it to create and implement programmatic functions within Google's public cloud, without having to provision the underlying cloud infrastructure -- such as servers, storage and other resources.
Google Cloud Functions allows small code segments to perform specific, limited tasks, which are typically related to triggering responses to real-world and software-driven events. When an event triggers an associated function, the function is loaded into a provisioned cloud environment and executed. All infrastructure resources are provisioned and recovered automatically by Google Cloud Platform (GCP).
Once the function's code executes, the function and its associated resources are dismissed. Consequently, cloud function services are priced per-function rather than by the cloud resources used.
Google Cloud Functions key features
Like all serverless offerings, Google Cloud Functions emphasizes simplicity for users. Because the service abstracts and automates the underlying infrastructure, users can focus on building function code rather than architecting cloud infrastructure.
Google Cloud Functions also underscores the idea of scalability. To prevent low performance and high costs, the service automatically scales resources up and down in response to function demand.
Different sources inside and outside of GCP can trigger functions. For example, an application that runs on GCP, or services such as Firebase and Google Assistant, can trigger a function. HTTP hooks from web, mobile and backend applications can also trigger functions. Thus, Google Cloud Functions can respond to programmatic and real-time/real-world events. For example, functions may be called to transform and move data generated by IoT devices, or to process data when a change -- such as an object addition -- occurs in a cloud storage instance.
Uses for Google Cloud Functions
An organization can use Google Cloud Functions in a variety of ways. One example is to trigger log analysis. In this scenario, a function might look for specific events -- such as an error -- within other cloud services or applications, trigger a check of log files and send desired log entries to specific administrators or developers through a notification service.
Functions can also trigger other tasks, such as backups. For example, a function might trigger a data backup when a certain prescribed time has elapsed, or when another event has occurred, such as a key resource remaining idle for some length of time. Functions can similarly trigger other actions, such as report generation.
Organizations often use functions to perform regular or redundant tasks upon data sets, such as processing image files. For example, a new image stored to a cloud storage instance could trigger a function to color-adjust, scale and save the processed image file. A function might be also be called to normalize a new data set before a copy of the data moves from a storage resource into another tool, such as a cloud database or big data analytics service for further processing.
Google Cloud Functions pricing and competition
Google Cloud Functions pricing is based on several factors, including the number of requests, as well as the value of the memory, processor and network data resources that are used, to the nearest 100 milliseconds, while the function runs. Google Cloud Functions users can also take advantage of a free usage tier which currently includes:
- 2 million calls
- 400,000 GB-seconds and 200,000 GHz-seconds of compute time
- Up to 5 GB of cloud egress per month
Ingress data, as well as outbound data to Google APIs in the same region, are also free. GCP provides a pricing calculator that can help users approximate the cost of a function.