Build a Serverless App with Cloud Run that Creates PDF Files
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.
This diagram gives you an overview of the services you will be using and how they connect to one another:
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
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
vi, etc.) or you can launch the code editor from Cloud Shell, which can be found in the top ribbon:
Once you're ready, scroll down and follow the steps below to setup your lab environment.
加入 Qwiklabs 即可阅读本实验的剩余内容…以及更多精彩内容！
- 获取对“Google Cloud Console”的临时访问权限。
- 200 多项实验，从入门级实验到高级实验，应有尽有。
Build simple a REST API
Create a Revision for Cloud Run
Create two cloud storage buckets
Create a Pub/Sub topic for receiving notification from storage bucket
Create a Pub/Sub subscription
Create another build for REST API
Create a new Revision