# cloudrun

Published articles for cloudrun.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Serverless Data Pipelines in GCP using Dataform and BigQuery Remote Functions

DevFeed: [Serverless Data Pipelines in GCP using Dataform and BigQuery Remote Functions](<https://devfeed.tech/articles/serverless-data-pipelines-in-gcp-using-dataform-and-bigquery-remote-functions-23880.md>)

Original publisher: [Read original article](<https://engineering.premise.com/serverless-data-pipelines-in-gcp-using-dataform-and-bigquery-remote-functions-9ee235d0cb18?source=rss----c5fada0a103d---4>)

Author: Austen Novis

Published: 2023-08-23T13:35:22Z

Content type: tutorial

Language: en

Sources: [Engineering at Premise](<https://devfeed.tech/sources/engineering-at-premise-medium.md>)

Topics: [dataform](<https://devfeed.tech/topics/dataform.md>), [Data pipelines](<https://devfeed.tech/topics/data-pipelines.md>), [BigQuery](<https://devfeed.tech/topics/bigquery.md>), [Serverless](<https://devfeed.tech/topics/serverless.md>), [Google Cloud Platform (GCP)](<https://devfeed.tech/topics/google-cloud.md>)

Tags: [bigquery](<https://devfeed.tech/tags/bigquery.md>), [cloud-computing](<https://devfeed.tech/tags/cloud-computing.md>), [cloudrun](<https://devfeed.tech/tags/cloudrun.md>), [custom](<https://devfeed.tech/tags/custom.md>), [data-engineering](<https://devfeed.tech/tags/data-engineering.md>), [data-pipelines](<https://devfeed.tech/tags/data-pipelines.md>), [data-scientists](<https://devfeed.tech/tags/data-scientists.md>), [dataform](<https://devfeed.tech/tags/dataform.md>), [error](<https://devfeed.tech/tags/error.md>), [example](<https://devfeed.tech/tags/example.md>), [external](<https://devfeed.tech/tags/external.md>), [gcp](<https://devfeed.tech/tags/gcp.md>), [github](<https://devfeed.tech/tags/github.md>), [gitlab](<https://devfeed.tech/tags/gitlab.md>), [goblet](<https://devfeed.tech/tags/goblet.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [language](<https://devfeed.tech/tags/language.md>), [logic](<https://devfeed.tech/tags/logic.md>), [orchestration](<https://devfeed.tech/tags/orchestration.md>), [permissions](<https://devfeed.tech/tags/permissions.md>), [remote](<https://devfeed.tech/tags/remote.md>), [serverless](<https://devfeed.tech/tags/serverless.md>)

### AI overview

Dataform can orchestrate SQL pipelines in GCP, with GitHub or GitLab integration and failure monitoring, but its limited support for JavaScript constrains custom logic. The example extends it with a BigQuery Remote Function hosted through Goblet: grant the Dataform service account BigQuery read/write access (the article suggests roles/bigquery.user), create a dataset and Dataform workspace, define a Python function, then run `goblet deploy` to provision the Cloud Function, BigQuery connection and routine, and invoker permissions. A downstream Dataform table calls that routine with `val` and `type`; the sample doubles, squares, or zeroes the value. This allows custom code, including possible model calls, to participate in the pipeline. The article presents a specific setup example rather than a comparison with other workflow tools.

### Source excerpt

Photo by Growtika on Unsplash Dataform is an amazing new offering from Google Cloud Platform (GCP) that allows for serverless orchestration for data pipelines. Previously, data engineering pipelines were either supported by separate data engineering teams, which many smaller organizations don't have the resources to support, or were stitched together using a series of interrelated BigQuery scheduled queries, which could be time-consuming to build and error-prone to run and maintain. Dataform solves these problems, especially for data scientists and data analysts, by including features such as Ability to build data pipelines using SQL Integrates with GitHub and GitLab for code versioning and deployment Monitor pipelines for failures and trigger alerts The main limitation of Dataform is that it only supports SQL, with limited ability to add javascript, but this limitation can be overcome with BigQuery Remote Functions. BigQuery Remote Functions allow you to call external services running in Cloudrun or Cloudfunctions from BigQuery, making it possible to have a serverless data pipeline that can run custom logic in any programming language that you may need. The rest of this blog post will go through a complete example on how to setup both Dataform and BigQuery Remote Functions in just a few steps. Setup Dataform We will begin by setting up a simple Dataform pipeline in the GCP console. Navigate to Dataform and create a repository. Create Repository Make sure to grant the default Dataform service account service-PROJECT_ID@gcp-sa-dataform.iam.gserviceaccount.com BigQuery read and write permissions. This can be accomplished using the roles/bigquery.user role. Next create a new development workspace and allow GCP to initialize it, which will add the default files needed to run the pipeline. Dataform files Next create a new BigQuery dataset called tutorial , and inside a table called test with schema id: int, val: int, type: str . BigQuery Schema We can insert some test da

## Tutorial: Low Usage Alerting On Slack for Google Cloud Platform (GCP)

DevFeed: [Tutorial: Low Usage Alerting On Slack for Google Cloud Platform (GCP)](<https://devfeed.tech/articles/tutorial-low-usage-alerting-on-slack-for-google-cloud-platform-gcp-23882.md>)

Original publisher: [Read original article](<https://engineering.premise.com/tutorial-low-usage-alerting-on-slack-for-google-cloud-platform-gcp-cc68ac8ca4d?source=rss----c5fada0a103d---4>)

Author: Mauricio Martinez

Published: 2023-04-24T15:57:09Z

Content type: tutorial

Language: en

Sources: [Engineering at Premise](<https://devfeed.tech/sources/engineering-at-premise-medium.md>)

Topics: [Google Cloud Platform (GCP)](<https://devfeed.tech/topics/google-cloud.md>), [cost-optimization](<https://devfeed.tech/topics/cost-optimization.md>), [Cloud Monitoring](<https://devfeed.tech/topics/cloud-monitoring.md>), [Cloud Functions](<https://devfeed.tech/topics/cloud-functions.md>), [Slack](<https://devfeed.tech/topics/slack.md>), [function as a service](<https://devfeed.tech/topics/function-as-a-service.md>)

Tags: [alerting](<https://devfeed.tech/tags/alerting.md>), [api](<https://devfeed.tech/tags/api.md>), [cloud-computing](<https://devfeed.tech/tags/cloud-computing.md>), [cloud-run](<https://devfeed.tech/tags/cloud-run.md>), [cloudrun](<https://devfeed.tech/tags/cloudrun.md>), [cost](<https://devfeed.tech/tags/cost.md>), [cost-savings](<https://devfeed.tech/tags/cost-savings.md>), [cpu](<https://devfeed.tech/tags/cpu.md>), [cron](<https://devfeed.tech/tags/cron.md>), [gcp](<https://devfeed.tech/tags/gcp.md>), [metrics](<https://devfeed.tech/tags/metrics.md>), [monitor](<https://devfeed.tech/tags/monitor.md>), [python](<https://devfeed.tech/tags/python.md>), [slack](<https://devfeed.tech/tags/slack.md>), [tutorial](<https://devfeed.tech/tags/tutorial.md>)

### AI overview

The tutorial describes a weekly Python Cloud Function that checks Cloud Run CPU and memory utilization and sends service owners Slack alerts when usage stays below configured thresholds, indicating a possible downscale. Its MQL queries group metrics by service and location and use the 99th percentile over a one-week interval; additional checks skip services already at minimum thresholds. The function uses the Metrics API, goblet, and goblet-gcp-client, with Cloud Scheduler triggering the weekly run. Deployment requires configuring a Slack channel and token, service account, thresholds, and cron expression, then installing dependencies and running goblet deploy. The excerpt says other resource types can be monitored with different MQL queries.

### Source excerpt

Google Cloud Platform (GCP) is a powerful cloud computing platform that allows businesses to run their applications and workloads with ease. However, as the number of services and applications increases, it becomes challenging to keep track of the usage of each service and ensure they are cost optimized. To address this issue, we can deploy a Python-based Cloud Function that will monitor the low usage of GCP services and notify service owners weekly via Slack that their service can be safely downscaled to minimize costs. This tutorial will walk you through setting up this entire flow in a few quick and easy steps, while allowing you to easily customize the service thresholds, Slack message ui, and the cron schedule. The code for this tutorial can be found on our gcp-tutorials GitHub repository. ArchitectureGet CPU/Memory Usage Metrics We can use the Metrics Explorer UI to build a MQL query to retrieve the desired data from the monitoring metrics API. In this tutorial we will monitor Cloud Run services, but you can monitor other resources by using a different MQL query. In our example we selected the CPU and Memory Cloud Run metrics: We group by service name and location and select the alignment for the 99th percentage to get the max usage over the 1 week duration. Then click on CODE EDITOR to generate a sample MQL query: fetch cloud_run_revision | metric 'run.googleapis.com/container/cpu/utilizations' | group_by 1w, [value_utilizations_percentile: percentile(value.utilizations, 99)] | every 1w | group_by [resource.service_name, resource.location], [value_utilizations_percentile_max: max(value_utilizations_percentile)]fetch cloud_run_revision | metric 'run.googleapis.com/container/memory/utilizations' | group_by 1w, [value_utilizations_percentile: percentile(value.utilizations, 99)] | every 1w | group_by [resource.service_name, resource.location], [value_utilizations_percentile_max: max(value_utilizations_percentile)]Code Once we have our MQL queries we will use the

## Hosting a fully Serverless Web-Based Postgres Admin Client on GCP using Pgweb, Cloud Run, & IAP

DevFeed: [Hosting a fully Serverless Web-Based Postgres Admin Client on GCP using Pgweb, Cloud Run, & IAP](<https://devfeed.tech/articles/hosting-a-fully-serverless-web-based-postgres-admin-client-on-gcp-using-pgweb-cloud-run-iap-23878.md>)

Original publisher: [Read original article](<https://engineering.premise.com/hosting-a-fully-serverless-web-based-postgres-admin-client-on-gcp-using-pgweb-cloud-run-iap-cff0ce8f471b?source=rss----c5fada0a103d---4>)

Author: Austen Novis

Published: 2023-03-06T13:17:20Z

Content type: tutorial

Language: en

Sources: [Engineering at Premise](<https://devfeed.tech/sources/engineering-at-premise-medium.md>)

Topics: [Cloud Run](<https://devfeed.tech/topics/cloud-run.md>), [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [Google Cloud Platform (GCP)](<https://devfeed.tech/topics/google-cloud.md>), [Serverless](<https://devfeed.tech/topics/serverless.md>), [Authentication](<https://devfeed.tech/topics/authentication.md>), [Command-line interface](<https://devfeed.tech/topics/cli.md>), [container](<https://devfeed.tech/topics/container.md>)

Tags: [authentication](<https://devfeed.tech/tags/authentication.md>), [cli](<https://devfeed.tech/tags/cli.md>), [cloud-computing](<https://devfeed.tech/tags/cloud-computing.md>), [cloud-run](<https://devfeed.tech/tags/cloud-run.md>), [cloud-sql](<https://devfeed.tech/tags/cloud-sql.md>), [cloudrun](<https://devfeed.tech/tags/cloudrun.md>), [container](<https://devfeed.tech/tags/container.md>), [deploy](<https://devfeed.tech/tags/deploy.md>), [gcp](<https://devfeed.tech/tags/gcp.md>), [google-cloud-platform](<https://devfeed.tech/tags/google-cloud-platform.md>), [identity-aware-proxy](<https://devfeed.tech/tags/identity-aware-proxy.md>), [pgweb](<https://devfeed.tech/tags/pgweb.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [serverless](<https://devfeed.tech/tags/serverless.md>), [vpc](<https://devfeed.tech/tags/vpc.md>)

### AI overview

A tutorial explains how to deploy Pgweb, a Go-based PostgreSQL administration client, as a serverless web application on Google Cloud. It uses Cloud Run, CloudSQL, a CloudSQL connector, Secret Manager, Artifact Registry, and optionally an HTTP load balancer with Identity-Aware Proxy for authentication.

### Source excerpt

By Austen Novis, Staff Software Engineer Pgweb example screenshot There are a number of quality Postgres open source administration tools such as pgAdmin or DBeaver, but these tools require a persistent server to run. This means that each user needs to install the tool locally and setup their connections, or you need to host the tool in a cloud server, which can get expensive. A much cheaper alternative is to use Pgweb, a lightweight web-based database explorer for PostgreSQL written in Go, and deploy to Cloud Run. This allows you to utilize a web-based tool, for minimal cost, that can scale for any number of users. We will leverage several Google Cloud Platform services for the complete setup starting with a http load balancer to allow for a custom DNS name as well as enable Identity Aware Proxy (IAP), which is what we will be using for authentication. We will host the service in Cloud Run and connect directly to CloudSQL using a CloudSQL connector. You can bypass the load balancer and IAP if you would like to use username and passwords for authentication. Cloud componentsCloud Setup The first step is setting up your CloudSQL instance. This can be done via terraform or in the GCP console. The main requirement is that you enable a public ip address, which will allow us to use the CloudSQL Auth proxy to connect our Cloud Run instance to our CloudSQL instance. If this is not possible you can still connect to your CloudSQL instance to Cloud Run through a VPC Connector instead. Next we will need to save our database connection credentials in GCP's Secret Manger by creating a new secret called PGWEB_DATABASE_URL in the format of postgres:///DB_NAME?host=/cloudsql/PROJECT:REGION:INSTANCE_NAME&user=DB_USER&password=DB_PASSWORD . Now that we have our CloudSQL instance and connection secret we will deploy our Cloud Run instance using the gcloud cli. First we will need to push the desired Pgweb container to GCP's Artifact Registry, which we can do using the following commands