9.2 Deploying Pub/Sub, Dataflow & Loading Data into Google Cloud

Key Takeaways

  • Pub/Sub topics are append-only message stores; subscriptions (pull or push) deliver to subscribers, with a default 7-day (up to 31-day) retention window and dead-letter topics for repeated delivery failures.
  • Dataflow runs Apache Beam pipelines in batch or streaming mode; Flex templates (Docker image plus a Cloud Storage spec file) are the current recommended packaging over classic templates.
  • BigQuery load jobs cap out at 15 TB and 10,000 files per job across CSV/JSON/Avro/Parquet/ORC, with gzip as the only supported CSV/JSON compression.
  • Storage Transfer Service is the managed, code-free choice for large or recurring transfers from S3, Azure Blob Storage, HDFS, or on-prem POSIX sources -- reach for Dataflow only when the data needs transformation in flight.
  • Match the loading method to volume and frequency: command-line tools for ad hoc small files, BigQuery load jobs for staged batch files, Storage Transfer Service for ongoing bulk migration.
Last updated: July 2026

Why This Section Matters

The exam guide's data-products bullet also names Pub/Sub and Dataflow among the things you must know how to deploy, and a separate bullet -- "Loading data (e.g., command line upload, load data from Cloud Storage, Storage Transfer Service)" -- tests how you move data into Google Cloud in the first place. Together these form the "plumbing" half of Domain 3's data content: messaging between services, transforming data in flight, and bulk-loading it from wherever it currently lives. Expect scenario questions that describe a data volume, source system, and freshness requirement, then ask you to pick the right ingestion tool -- confusing Storage Transfer Service (a managed copy job) with Dataflow (a transformation pipeline) is one of the most common ACE traps.

Pub/Sub -- Asynchronous Messaging

Pub/Sub decouples publishers from subscribers using two objects:

  • A topic -- an append-only named resource that publishers send messages to.
  • A subscription -- attached to a topic, delivers each message to its subscriber (a topic can have many subscriptions, giving fan-out to multiple independent consumers).
gcloud pubsub topics create order-events
gcloud pubsub subscriptions create order-events-sub \
  --topic=order-events --ack-deadline=30 \
  --message-retention-duration=7d

Delivery works in two modes:

ModeHow it worksBest for
PullSubscriber (an app or a Dataflow job) actively requests messages and acknowledges themBatch-style or high-throughput consumers that control their own pace
PushPub/Sub sends an HTTP POST to your endpoint; a 2xx response acknowledges the messageLightweight, webhook-style consumers such as Cloud Run or Cloud Functions

Three deployment details the exam likes to test:

  • Message retention: the default is 7 days after publish, and messages (acknowledged or not, depending on configuration) can be retained for up to 31 days, which lets a newly created subscription "replay" recent history instead of only seeing messages published after it existed.
  • Ordering keys: attaching an ordering key to messages guarantees per-key delivery order, but push subscriptions allow only one outstanding message per ordering key at a time, which can add latency -- pull is usually preferred for high-volume ordered streams.
  • Dead-letter topics: after a configurable maximum delivery attempts count, Pub/Sub forwards a message it cannot get acknowledged to a separate dead-letter topic for offline investigation, instead of retrying it forever.

Dataflow -- Managed Apache Beam Pipelines

Dataflow runs data-processing pipelines written against the open source Apache Beam model, in either batch mode (bounded data, such as a nightly file drop) or streaming mode (unbounded data, such as a live Pub/Sub topic) using the same programming model for both.

You rarely write a pipeline from scratch for common extract-transform-load (ETL) work: Google publishes ready-to-run Dataflow templates, and you launch one instead of authoring custom code:

gcloud dataflow jobs run pubsub-to-bq \
  --gcs-location=gs://dataflow-templates/latest/PubSub_Subscription_to_BigQuery \
  --region=us-central1 \
  --parameters inputSubscription=projects/my-proj/subscriptions/order-events-sub,outputTableSpec=my-proj:sales_ds.orders

There are two template families:

  • Classic templates -- the original format; parameters are effectively fixed once the template is staged.
  • Flex templates -- Google's current recommendation for any new template. The pipeline is packaged as a Docker image in Artifact Registry, referenced by a small specification file in Cloud Storage; this allows more flexible runtime parameters and support for arbitrary custom sources and sinks.

A common ACE-style scenario reads: "events land continuously in a Pub/Sub topic and must be transformed and written into BigQuery in near real time." The answer is a Dataflow streaming job -- ideally launched from a Google-provided template such as Pub/Sub Subscription to BigQuery -- not a manual bq load, which is a batch-only path that cannot consume a live topic. Note also that Google-managed template jobs now run on Dataflow Prime (an autotuning execution mode) by default; if a scenario calls for the older, standard Dataflow execution behavior, you disable Prime with the enable_prime=false service option.

Loading Data Into Google Cloud

The exam guide names three loading paths, each suited to a different volume and frequency profile:

MethodTypical useNotes
Command-line uploadSmall-to-moderate one-off files, ad hoc workgcloud storage cp (the current CLI, replacing gsutil cp) for Cloud Storage objects; bq load to load directly into a BigQuery table from a local file or a gs:// path
Load data from Cloud StorageRecurring batch loads of files already staged in a bucketBigQuery load jobs read CSV, newline-delimited JSON, Avro, Parquet, or ORC; a single load job can process up to 15 TB across up to 10,000 files; gzip is the only supported compression for CSV/JSON
Storage Transfer ServiceLarge, recurring, or scheduled transfers from another cloud or on-prem systemManaged, code-free transfers from Amazon S3, Azure Blob Storage, HDFS, and on-prem POSIX filesystems into Cloud Storage; optimized for transfers over 1 TiB; supports both one-time and repeating scheduled jobs

A frequent exam trap is reaching for a custom Dataflow pipeline to "just copy files" from Amazon S3 into Cloud Storage -- that is exactly what Storage Transfer Service already does, managed and without custom code. Save Dataflow for when the data genuinely needs transformation in flight, not just relocation. For extremely large, one-time, offline migrations (measured in hundreds of terabytes or petabytes) where shipping data over the network is impractical, Google also offers the Transfer Appliance, a physical device you load on-site and ship back to Google -- rarely the right answer on the ACE exam, but useful to recognize as an outlier compared to the three primary loading paths above.

Test Your Knowledge

Your team needs to migrate 40 TB of log files from an on-premises Hadoop Distributed File System (HDFS) cluster into Cloud Storage on a recurring nightly schedule, with no transformation required. Which tool should you use?

A
B
C
D
Test Your Knowledge

A subscription must guarantee that messages sharing the same key are processed in the order they were published. What must you configure, and what tradeoff does it introduce for push delivery?

A
B
C
D
Test Your Knowledge

Which statement correctly distinguishes Dataflow Flex templates from classic templates?

A
B
C
D