menu
arrow_back

Build a Serverless App with Cloud Run that Creates PDF Files

Build a Serverless App with Cloud Run that Creates PDF Files

1 hour 5 Credits

GSP644

Google Cloud Self-Paced Labs

image

Overview

For the labs in the GCP Serverless Workshop: Pet Theory Quest, you will read through a fictitious business scenario and assist the characters with their serverless migration plan.

Twelve years ago, Lily started the Pet Theory chain of veterinary clinics. Pet Theory currently sends invoices in DOCX format to clients, but many clients have complained that they are unable to open them. To improve customer satisfaction, Lily has asked Patrick in IT to investigate an alternative to improve the current situation.

Pet Theory's Ops team is a single person, so they are keen to invest in a cost efficient solution that doesn't require a lot of ongoing maintenance. After analyzing the various processing options, Patrick decides to use Cloud Run.

Cloud Run is serverless, so it abstracts away all infrastructure management and lets you focus on building your application instead of worrying about overhead. As a Google serverless product, it is able to scale to zero, meaning it won't incur cost when not used. It also lets you use custom binary packages based on containers, which means building consistent isolated artifacts is now feasible.

In this lab you will build a PDF converter web app on Cloud Run that automatically converts files stored in Cloud Storage into PDFs stored in seperated folders.

Architecture

This diagram gives you an overview of the services you will be using and how they connect to one another:

arch.png

What you will learn

In this lab, you will learn how to:

  • Convert a Node JS application to a container.
  • Build containers with Google Cloud Build.
  • Create a Cloud Run service that converts files to PDF files in the cloud.
  • Use event processing with Google Cloud Storage

Prerequisites

This is a fundamental level lab. This assumes familiarity with the GCP Console and shell environments. Experience with Firebase will be helpful, but it is not required. Before taking this lab it is recommended that you have completed the following Qwiklabs before taking this one:

You should also be comfortable editing files. You can use your favorite text editor (like nano, vi, etc.) or you can launch the code editor from Cloud Shell, which can be found in the top ribbon:

ba731110a97f468f.png

Once you're ready, scroll down and follow the steps below to setup your lab environment.

Join Qwiklabs to read the rest of this lab...and more!

  • Get temporary access to the Google Cloud Console.
  • Over 200 labs from beginner to advanced levels.
  • Bite-sized so you can learn at your own pace.
Join to Start This Lab
Score

—/100

Build simple a REST API

Run Step

/ 20

Create a Revision for Cloud Run

Run Step

/ 20

Create two cloud storage buckets

Run Step

/ 10

Create a Pub/Sub topic for receiving notification from storage bucket

Run Step

/ 10

Create a Pub/Sub subscription

Run Step

/ 10

Create another build for REST API

Run Step

/ 15

Create a new Revision

Run Step

/ 15