Prepare and test your skills

Prepare and test your skills

Job automation and orchestration (e.g., Cloud Composer and Workflows) coordinates data pipelines across Google Cloud services without manual intervention. Google Cloud Workflows (opens in a new tab) handles serverless orchestration of HTTP-based services with low latency, while Managed Service for Apache Airflow (Managed Airflow), formerly Cloud Composer, handles batch extract, transform, and load (ETL) and extract, load, and transform (ELT) pipelines defined as Python Directed Acyclic Graphs (DAGs). Security for both depends on user-managed service accounts with narrow Identity and Access Management (IAM) roles, and reliability depends on managed infrastructure with Cloud Logging and Cloud Monitoring.
Choosing between Workflows and Managed Airflow starts with workload shape, latency tolerance, and code type. Workflows executes a state machine defined in YAML or JSON that calls microservices, infrastructure tasks, and external systems in order, with millisecond execution latency, high execution volume, and scale down to zero. Managed Airflow executes Python DAG files with declarative dependency resolution, tolerates a few seconds of latency between tasks, and supports backfills and DAG re-runs for data processing. Workflows integrates through HTTP requests and connectors and passes up to 512 KB in variables between steps, while Managed Airflow integrates through Airflow Operators and Sensors, with over 150 operators for Google Cloud alone, and passes up to 48 KB through XCom between tasks.
| Dimension | Workflows | Managed Airflow |
|---|---|---|
| Best fit | Chaining microservices, infrastructure automation, external integrations | Batch ETL/ELT, triggering BigQuery jobs or Dataflow pipelines |
| Triggers | gcloud CLI, console, Workflows API, client libraries, Cloud Scheduler | Cron-like schedules in DAG files, Sensors |
| Parallelism | Polling, callbacks, wait for long-running operations; concurrent executions or parallel steps | Polling; automatic parallelism from task dependencies |
| Scaling and billing | Serverless scaling; usage-based per step executed | Provisioned capacity; billed on provisioned capacity |
Dataform focuses on data transformation in SQL, Workflows focuses on microservices in YAML or JSON, Managed Airflow focuses on ETL or ELT in Python, and Vertex AI Pipelines focuses on machine learning in Python. Choose Workflows when the problem is coordinating existing services with low latency, and choose Managed Airflow when the problem is transforming data with complex batch dependencies.
Exam tip: Choose Workflows when millisecond latency and per-step billing matter, and choose Managed Airflow when the pipeline needs backfills, re-runs, and cron-like batch scheduling with seconds-level latency.
Time-driven scheduling with Cloud Scheduler and Dataform runs transformation code on a fixed frequency. A Cloud Scheduler job triggers a Workflows workflow at the configured frequency, and Workflows then executes the Dataform workflow against BigQuery. First, Workflows pulls Dataform repository code from the Git provider and compiles it into a compilation result, then Workflows uses that compilation result to create a workflow invocation and executes it. Calling createCompilationResult with gitCommitish requires Dataform to clone the remote Git repository over the network on every run. Because external network connections can be temporarily unreliable during frequent or concurrent compilations, production schedules should use release configurations or configure automated retries with exponential backoff, trading per-run freshness of Git code for reliability and resource efficiency.
Identity and secure access for orchestration centers on a dedicated service account used as the workflow identity. The service account acts when Workflows calls Dataform and manages the orchestration workflow, so the policy applies to the workflow rather than to an individual user. Grant the service account only the roles each stage requires:
Secure orchestration in Managed Airflow centers on a dedicated user-managed service account that owns the environment and runs the DAGs. A typical ETL identity needs Composer Worker as the baseline plus only the extra data permissions the DAGs require, such as BigQuery and Storage roles for operators or Dataflow roles for a combined Composer and Dataflow pipeline. The Managed Airflow control plane has its own identity boundary through the Cloud Composer Service Agent, which requires the Cloud Composer v2 API Service Agent Extension role for Composer 2 environments. Secrets move out of code into Secret Manager when used as the Airflow secret backend, and when Cloud Key Management Service (Cloud KMS) or customer-managed encryption keys protect the environment, the customer must maintain key permissions and rotation.
Operational resilience for Managed Airflow keeps pipelines observable and recoverable through managed infrastructure and shared responsibility. A Managed Airflow environment provisions a Google Kubernetes Engine (GKE) cluster, an Airflow web server, an environment bucket, and supporting services including Cloud SQL, Pub/Sub, and Artifact Registry. Airflow schedulers, triggerers, and workers run as GKE workloads and execute DAG tasks, while Composer Agent and Airflow Monitoring run in the same cluster to gather logs to Cloud Logging and metrics to Cloud Monitoring. Google owns hardening and patching of environment components and underlying infrastructure, including auto-upgrades of GKE and Cloud SQL, default encryption at rest, encryption in transit, and IAM and audit-log integrations. The customer owns DAG compatibility with the selected Airflow version, timely upgrades to supported versions, and correct IAM on the environment service account, bucket, and encryption keys.
Reliable provisioning follows an explicit dependency order where each resource depends on the prior layer:
composer.googleapis.com plus compute, logging, monitoring, storage, resource manager, service directory, Pub/Sub, Cloud SQL, and conditional APIs such as Secret Manager, Cloud KMS, and Artifact Registry.DAG design and environment optimization define how batch pipelines run reliably at scale while minimizing always-on cost. A Cloud Composer DAG defines a sequence of tasks that run only after their upstream dependencies succeed, so task order enforces validation before processing and cleanup only after processing completes. DAG files are Python files stored in a Cloud Storage bucket attached to the environment, and recovery focuses on data in Cloud Storage and the metadata store rather than the running orchestrator. Efficient design keeps heavy processing in ephemeral compute and keeps the DAG itself lightweight, deterministic, and recoverable.
A batch point-of-sale pattern shows how a DAG coordinates ephemeral processing:
Data flows from Cloud Storage to the ephemeral Spark cluster for transformation, then to the data lake in columnar formats such as Parquet and ORC, with table metadata in Dataproc Metastore. For Dataform scheduling, Managed Airflow 2 provides Dataform operators that create a compilation result and then create a workflow invocation from that result, including DataformCreateCompilationResultOperator, DataformCreateWorkflowInvocationOperator, and operators for getting and canceling results and invocations. The dependency create_compilation_result >> create_workflow_invocation ensures that compilation finishes first and its output name flows into the invocation task.
CI/CD (Continuous Integration and Continuous Deployment) for data pipelines builds, tests, versions, and promotes code and infrastructure through isolated environments with least-privilege identities. Cloud Build validates changes on commit or pull request, Artifact Registry stores immutable artifacts, and Cloud Deploy promotes only verified images to the next environment. Data flows from the source repository to Cloud Build and then to Artifact Registry, and the deployment stage pulls only the promoted digest from Artifact Registry to the target environment.
Container artifact versioning with Artifact Registry gives centralized visibility and control over the software supply chain. Artifact Registry is a universal package manager for build artifacts and dependencies, so pipeline code, container images, and pipeline components carry versions that integrate with builds and staged delivery. The same immutable digest moves from development to test to production and supports rollback to a known safe version, which guarantees that test and production run exactly the same bits. Artifact protection also depends on access control, Virtual Private Cloud (VPC) Service Controls perimeters, and organizational policies applied to the registry.
Artifact Registry isolates trusted code from external code through repository types and security controls. Remote repositories cache artifacts from preset external sources to reduce download time, improve availability, and enable vulnerability scanning when scanning is enabled:
Vulnerability scanning and deployment enforcement establish whether an image is safe to deploy and who built it. Artifact Analysis scans new images when they are uploaded to Artifact Registry by extracting system package information, then continuously monitors scanned metadata as new vulnerability information arrives, updating metadata and creating or deleting occurrences. Scanning runs as on-demand or automated scanning for base container images and language packages, and Artifact Analysis also generates a software bill of materials (SBOM) and uploads Vulnerability Exploitability eXchange (VEX) statements for images in Artifact Registry. Cloud Build runs builds in isolated and ephemeral environments and supports Supply-chain Levels for Software Artifacts (SLSA) Level 3 builds with authenticated and non-falsifiable provenance, including digests, source locations, toolchain, build steps, and duration.
Binary Authorization attaches attestations, which are configurable signatures, to container images and checks them at deployment time to Google Kubernetes Engine (GKE), GKE Enterprise, and Cloud Run. Binary Authorization enforces that only trusted code runs by verifying promotion criteria before the target platform admits the image:
Exam tip: Artifact Analysis detects vulnerabilities in Artifact Registry images, while Binary Authorization blocks deployment unless required attestations for builder identity, vulnerability policy, and environment promotion are present.
Least-privilege identities for deployment pipelines mean each stage uses its own service account with only the permissions that stage requires. Where possible, use unique credentials for each environment, effectively for each project, and limit access to resources in that project. The pipeline scope must stay small by granting access to individual resources instead of the project level, avoiding cross-project access, and splitting a multi-environment pipeline into individually secured stages so a compromised stage cannot damage all data and applications.
| Service account | Controls | Least-privilege rule |
|---|---|---|
| Artifact staging account | Cloud Storage buckets holding templates, JAR files, and container references | Grant write only to the staging bucket in its own project |
| Dataflow management account | Dataflow job creation and lifecycle operations | Grant job-management roles without data source or sink access |
Dataflow worker account, set with --serviceAccount | Compute Engine workers and pipeline input and output access | Grant only compute management plus required source and sink access |
Specify a user-managed worker service account with the --serviceAccount pipeline option for production jobs. If no worker account is specified, Dataflow falls back to the Compute Engine default service account, which usually has broader permissions than Dataflow jobs require. Secure credential retrieval means the deployment process obtains short-scoped credentials from its own service account and never reuses credentials across environments, while confidentiality boundaries revoke unneeded read and write access, restrict outbound connectivity to an allow-list, and place projects inside VPC Service Controls perimeters. Input authenticity further requires signed third-party artifacts, curated publisher keys for Pretty Good Privacy and Authenticode signatures, hash verification, hardened Terraform, kubectl, Docker, and operating systems, Shielded VM builds, and static analysis with policy-as-code checks.
Automated testing and validation of pipeline code runs unit tests, integration tests, and static analysis inside Cloud Build triggers so bad changes are blocked before deployment. A commit or pull request in Git triggers Cloud Build, which pulls source and dependencies, runs validation, and only then promotes an immutable artifact to Artifact Registry for deployment by Cloud Deploy. This validation-before-promotion pattern protects downstream consumers that depend on stable schemas and business logic. Cloud Build enforces the strategy as a quality gate where failed tests stop image creation, artifact promotion, and deployment to testing, staging, or production.
The three test layers form a quality gate where each layer blocks a different class of failure:
Static analysis and artifact validation check code quality and supply-chain safety after unit tests pass and before deployment. Container Structure Tests perform command tests, file existence tests, file content tests, and metadata tests, while vulnerability scanning checks the image against a Google Cloud-maintained vulnerability database. Immutable container images ensure the same image runs across environments and is never patched in place, so configuration is externalized and read at run time and any fix requires building and redeploying a new image.
Validating Beam pipelines, Composer DAGs, and SQL logic applies the same gate to three different code types before costly state is created. Apache Beam pipelines are Python or Java codebases executed on Dataflow, often packaged as reusable Dataflow templates such as Pub/Sub to BigQuery and Cloud Storage text to BigQuery. Validation flows from source to artifact to execution in a fixed order where Cloud Build pulls the Beam codebase on push or pull request, runs static analysis and unit tests on transforms, runs integration tests across Cloud Storage, BigQuery, Pub/Sub, and Firestore connectors, then packages the approved template or container to Artifact Registry. This order matters because Dataflow jobs are bound to their project and stateful pipeline state is costly to fix after launch.
Validation of Managed Airflow uses two separate Cloud Build triggers with different purposes. The presubmit trigger runs on a pull request from a development branch to main and executes unit tests to check that the DAG is valid. The sync trigger runs only after approval and merge to main and copies the validated DAG into Cloud Storage in the development environment. Promotion preserves order and isolation between development and production:
Validation of SQL schemas protects BigQuery core tables and views that serve as the source of truth for analytics. Data flows from transactional sources into a staging area, then into core tables, then through an access layer of views that encapsulate business logic to dashboards, notebooks, and operational systems.
| Asset | Purpose in BigQuery | Validation in Cloud Build |
|---|---|---|
| Data definition language (DDL) | Defines schema of tables and views | Compile check and validation rules on created tables, often with Dataform |
| Data manipulation language (DML) | Manipulates data and creates tables from existing tables | Integration test on staging or cloned data for completeness and correctness |
| Data control language (DCL) | Controls permissions and access | Policy check with preference for IAM over SQL, bq tool, or REST API |
Infrastructure as Code and multi-environment promotion stores desired cloud infrastructure in Git as Terraform code and promotes it through automated Cloud Build pipelines. In this GitOps model, Git branches represent environments, and pushes to those branches trigger pipeline runs that make the real infrastructure match the code. Terraform state is stored in a Cloud Storage bucket so every build shares the same consistent view of what has already been deployed. When Terraform code is pushed to the dev or prod branch, Cloud Build triggers and runs terraform apply to change that environment, while a push to any feature branch runs only terraform plan so reviewers can see proposed changes without applying them.
| Pipeline | Provisioned by | Resources provisioned |
|---|---|---|
| Foundation pipeline | Bootstrap | Data platform folders, common projects, infrastructure pipeline service account and trigger, shared VPC, VPC Service Controls perimeter |
| Infrastructure pipeline | Foundation pipeline | Consumer projects, Service Catalog and artifact pipeline accounts and triggers |
| Service Catalog pipeline | Infrastructure pipeline | Resources in the Service Catalog bucket for development templates |
| Artifact pipelines | Infrastructure pipeline | Containers and codebase components used by data workloads |
Cloud Build automation for Terraform uses separate plan and apply configurations to enforce validation before deployment, with policy checks using Open Policy Agent constraints, least-privilege stage-specific service accounts, private pools inside a VPC Service Controls perimeter, custom builders with pinned versions, and optional manual approval. Promotion follows an ordered workflow that keeps every environment repeatable and auditable. First, create a feature branch from development and open a pull request targeting development, which triggers terraform plan and validation. Then merge to development after approval to deploy to development for testing. Then promote the same tested code forward to non-production and merge dev into prod to install in production.
Continue with this study guide: CI/CD (Continuous Integration and Continuous Deployment)
gitCommitish on every run to avoid Git clone failures under frequent or concurrent compilations.Use Google Cloud Workflows when coordinating existing HTTP-based microservices and infrastructure tasks defined in YAML or JSON where millisecond execution latency and usage-based per-step billing matter. Use Managed Service for Apache Airflow (Managed Airflow) when transforming data with complex batch extract, transform, and load or extract, load, and transform dependencies defined as Python Directed Acyclic Graphs that need backfills, re-runs, and cron-like scheduling with seconds-level latency.
A Cloud Scheduler job triggers a Google Cloud Workflows workflow at the configured frequency, and Workflows pulls Dataform repository code, compiles it into a compilation result, then creates a workflow invocation from that result to execute against BigQuery. Production schedules should use release configurations rather than calling createCompilationResult with gitCommitish on every run, or configure automated retries with exponential backoff, to avoid Git clone failures during frequent or concurrent compilations.
Artifact Analysis scans new images when uploaded to Artifact Registry and continuously monitors scanned metadata as new vulnerability information arrives, including generating a software bill of materials and Vulnerability Exploitability eXchange statements. Binary Authorization blocks deployment to Google Kubernetes Engine and Cloud Run unless required attestations are present verifying builder identity, vulnerability policy compliance, and promotion criteria from one environment to the next.
The presubmit Cloud Build trigger runs on a pull request to main and executes unit tests and static checks to validate the DAG, where failure blocks the merge. The sync Cloud Build trigger runs only after approval and merge to main and copies the validated DAG to Cloud Storage in the development environment for verification before the verified DAG is uploaded to the production environment.
Last updated