# 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.

## 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 - Medium](<https://devfeed.tech/sources/engineering-at-premise-medium.md>)

Topics: [Google Cloud Platform (GCP)](<https://devfeed.tech/topics/google-cloud.md>), [Cloud Run](<https://devfeed.tech/topics/cloud-run.md>), [Python](<https://devfeed.tech/topics/python.md>), [Monitoring](<https://devfeed.tech/topics/monitoring.md>), [Slack](<https://devfeed.tech/topics/slack.md>)

Tags: [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-savings](<https://devfeed.tech/tags/cost-savings.md>), [deploy](<https://devfeed.tech/tags/deploy.md>), [gcp](<https://devfeed.tech/tags/gcp.md>), [github](<https://devfeed.tech/tags/github.md>), [google-cloud](<https://devfeed.tech/tags/google-cloud.md>), [metrics](<https://devfeed.tech/tags/metrics.md>), [monitoring](<https://devfeed.tech/tags/monitoring.md>), [python](<https://devfeed.tech/tags/python.md>), [slack](<https://devfeed.tech/tags/slack.md>)

### AI overview

This tutorial explains how to deploy a Python-based Cloud Function that monitors weekly CPU and memory usage for Google Cloud services, including Cloud Run, and sends Slack notifications to service owners when a service may be safely downscaled to reduce costs. It covers creating MQL queries, retrieving monitoring metrics, checking minimum thresholds, and deploying the scheduled function.

### 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

## Deploy and Handle GCP CloudTasks with Goblet in minutes.

DevFeed: [Deploy and Handle GCP CloudTasks with Goblet in minutes.](<https://devfeed.tech/articles/deploy-and-handle-gcp-cloudtasks-with-goblet-in-minutes-23875.md>)

Original publisher: [Read original article](<https://engineering.premise.com/deploy-and-handle-gcp-cloudtasks-with-goblet-in-minutes-ee138e9dd2c5?source=rss----c5fada0a103d---4>)

Author: Mauricio Wittenberg

Published: 2023-04-18T13:55:58Z

Content type: tutorial

Language: en

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

Topics: [Google Cloud Platform (GCP)](<https://devfeed.tech/topics/google-cloud.md>), [Python](<https://devfeed.tech/topics/python.md>), [Microservices](<https://devfeed.tech/topics/microservices.md>), [Serverless](<https://devfeed.tech/topics/serverless.md>), [IAM](<https://devfeed.tech/topics/iam.md>), [Architecture & Design](<https://devfeed.tech/topics/architecture-design.md>), [Docker](<https://devfeed.tech/topics/docker.md>), [Docker Image](<https://devfeed.tech/topics/docker-image.md>)

Tags: [cloud-computing](<https://devfeed.tech/tags/cloud-computing.md>), [cloud-tasks](<https://devfeed.tech/tags/cloud-tasks.md>), [cloudrun](<https://devfeed.tech/tags/cloudrun.md>), [container-registry](<https://devfeed.tech/tags/container-registry.md>), [docker](<https://devfeed.tech/tags/docker.md>), [docker-image](<https://devfeed.tech/tags/docker-image.md>), [gcp](<https://devfeed.tech/tags/gcp.md>), [goblet](<https://devfeed.tech/tags/goblet.md>), [google-cloud](<https://devfeed.tech/tags/google-cloud.md>), [google-cloud-platform](<https://devfeed.tech/tags/google-cloud-platform.md>), [iam](<https://devfeed.tech/tags/iam.md>), [infrastructure](<https://devfeed.tech/tags/infrastructure.md>), [microservices](<https://devfeed.tech/tags/microservices.md>), [permissions](<https://devfeed.tech/tags/permissions.md>), [python](<https://devfeed.tech/tags/python.md>), [rate-limiting](<https://devfeed.tech/tags/rate-limiting.md>), [serverless](<https://devfeed.tech/tags/serverless.md>), [tutorial](<https://devfeed.tech/tags/tutorial.md>)

### AI overview

This tutorial explains how Goblet can deploy and manage Google Cloud Tasks for serverless microservices on Google Cloud Platform. It covers defining a queue, enqueuing and handling tasks in Python, configuring IAM permissions, and deploying related infrastructure, Docker images, and Cloud Run revisions.

### Source excerpt

by Mauricio Wittenberg. Goblet DeployIntroduction CloudTasks is a Google Cloud Platform (GCP) service that allows users to enqueue tasks in a queue. It is somewhat similar to PubSub, but with CloudTasks, the queue has features such as rateLimits and retryConfig. This can be very useful when having to enforce a rate limit over an external API or retrying tasks that have a known probability of failure. If you want to use CloudTasks you will have to manually deploy cloud infrastructure, understand the CloudTask object, deal with client libraries and figure out multiple IAM role bindings. Or you can use Goblet for all the heavy lifting and in just a few minutes be able push a task and later process the task in a Python function of our choosing. Goblet is a Python based cloud framework for building serverless microservices on Google Cloud Platform. It enables developers to quickly and reliably deploy cloud resources together with the code that will make use of those resources. In this blog post we will review how Goblet deploys CloudTaskQueues and provides the user with an simple code interface to enqueue and handle CloudTasks⁶. Using the short snipped of code below we can define a queue, create a client, push a task to the queue, and handle tasks from the queue! https://medium.com/media/d81fb2d8bd47a3f69479708d61dd5230/href See the rest of the tutorial for setting up your Goblet environment, setting permissions, and deploying you infrastructure and application in a few quick steps. Infrastructure For this tutorial we will use an example GCP project called goblet-cloudtask and deploy region specific resources to us-central1. If you would like to follow along the complete code can be found at gcp-tutorials. The account used to run this example must have enough IAM role binding to run all the gcloud commands described in the Set-Up section below. Now, let's take a look at the infrastructure Goblet will create. We won't have to take care of any of these steps ourselves. All

## 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 - Medium](<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