0
0
GCPcloud~5 mins

Cloud Functions with Pub/Sub triggers in GCP - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a Cloud Function triggered by Pub/Sub in Google Cloud?
It is a small piece of code that runs automatically when a message is published to a specific Pub/Sub topic.
Click to reveal answer
beginner
How does Pub/Sub deliver messages to a Cloud Function?
Pub/Sub sends messages to the Cloud Function as events, which then processes the message data inside the function code.
Click to reveal answer
intermediate
Why use Pub/Sub triggers for Cloud Functions instead of HTTP triggers?
Pub/Sub triggers are good for asynchronous, event-driven processing where messages are sent reliably and can be retried if processing fails.
Click to reveal answer
intermediate
What happens if a Cloud Function fails to process a Pub/Sub message?
The message can be retried automatically by Pub/Sub until it is successfully processed or until it reaches a maximum retry limit.
Click to reveal answer
advanced
How do you secure a Cloud Function triggered by Pub/Sub?
By setting proper IAM roles so only authorized services can publish messages to the Pub/Sub topic and invoke the function.
Click to reveal answer
What triggers a Cloud Function when using Pub/Sub?
AA new message published to a Pub/Sub topic
BAn HTTP request from a browser
CA scheduled timer event
DA file upload to Cloud Storage
What format does a Pub/Sub message have when received by a Cloud Function?
APlain text only
BHTML document
CBinary file
DJSON object inside the event data
If a Cloud Function fails to process a Pub/Sub message, what happens next?
AThe message is lost immediately
BThe function restarts automatically
CPub/Sub retries sending the message
DThe message is sent to an email
Which Google Cloud service is responsible for sending messages to trigger Cloud Functions?
ACloud Storage
BCloud Pub/Sub
CCloud SQL
DCloud Run
How can you restrict who can publish messages to a Pub/Sub topic?
ABy setting IAM permissions on the topic
BBy changing the Cloud Function code
CBy disabling the topic
DBy using a firewall rule
Explain how a Cloud Function is triggered by a Pub/Sub message and what happens inside the function.
Think about the flow from message sending to function execution.
You got /4 concepts.
    Describe how you would secure a Cloud Function that is triggered by Pub/Sub messages.
    Focus on permissions and access control.
    You got /4 concepts.