Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Labs

Triggering Cloud Run with Pub/Sub

In this lab, we will create a Cloud Run service that renders some 3D text and stores the image in a Cloud Storage bucket. The Cloud Run service will not be publicly available. Instead, we will create a Cloud Pub/Sub topic with an authenticated push subscription to send messages to our rendering service. You should be familiar with the GCP console, Cloud Shell, and service accounts to perform this hands-on lab. Some familiarity with Cloud Pub/Sub would be helpful but is not essential.

Lab platform
Lab Info
Level
Intermediate
Last updated
Sep 22, 2025
Duration
30m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Deploy the Rendering Service

    The code for the render service can be found at this GitHub repo:

    https://github.com/ACloudGuru-Resources/content-google-cloudrun-deepdive-render

    Note: Before you create the container, you will need to create a Cloud Storage bucket to hold rendered images. Then, you will need to update the code of the render service with the name of your bucket (line 35 of function.py).

    Build the container and push it to Google Container Registry, replacing <YOUR_PROJECT> with your project ID:

    gcloud builds submit --tag gcr.io/<YOUR_PROJECT>/render .
    

    The deployed service should not allow unauthenticated invocations.

  2. Challenge

    Configure Pub/Sub
    1. Create a service account with the Cloud Run Invoker role.
    2. Create a Cloud Pub/Sub topic.
    3. Create a subscription for the topic:
      • The subscription should be Push.
      • It should use the endpoint of the render service.
      • It should use the service account you just created.

    Note: When you enable authentication for the Push subscription, Pub/Sub will prompt you to add the iam.serviceAccountTokenCreator role and then reset the Add subscription form. This appears to be a normal (if somewhat quirky) behavior of the Cloud Console. Just re-enter the information to create the subscription, and it will work.

  3. Challenge

    Test the Service
    1. Publish some test messages to your Pub/Sub topic.
    2. View the rendered images in the Cloud Storage bucket.

    Images may take a minute or two to render before you can see them in the bucket. If you have any problems, check the logs of your Cloud Run service.

About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight