Triggering Airflow DAGs Reactively in Private Cloud Composer
You are deploying an Apache Airflow directed acyclic graph (DAG) in a Cloud Composer 2 instance. You have incoming files in a Cloud Storage bucket that the DAG processes, one file at a time. The Cloud Composer instance is deployed in a subnetwork with no Internet access. Instead of running the DAG based on a schedule, you want to run the DAG in a reactive way every time a new file is received. What should you do?
Community Votes
41% of anonymous learners picked answer C. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
Tests event-driven architecture constraints in restricted VPCs; the common trap is assuming direct Cloud Function-to-Airflow REST API triggers work in Private IP environments when they officially fail due to egress and DNS limitations.
Reactive DAG execution in a Private IP Cloud Composer environment requires routing Cloud Storage events through Pub/Sub rather than direct service calls, as documented by Google for isolated networks. Community consensus confirms this pattern avoids connectivity blockers while maintaining scalability.
Candidates frequently select C or D, attempting to connect Cloud Functions directly to the Airflow REST API via PSC or VPC Serverless Access. This overlooks Google's explicit documentation stating that direct GCF-to-Airflow triggers are unsupported in Private IP and VPC Service Controls configurations.
Community Discussion (10 comments)
- Enable Airflow REST API: In Cloud Composer, enable the "Airflow web server" option. - Set Up Cloud Storage Notifications: Create a notification for new files, routing to a Cloud Function. - Create PSC Endpoint: Establish a PSC endpoint for Cloud Composer. - Write Cloud Function: Code the function to use the Airflow REST API (via PSC endpoint) to trigger the DAG. ======== Why not Option D - Using the web server URL directly wouldn't work without internet access or a direct path to the web server.
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
Option A aligns with Google’s official architecture for reactive DAG execution in Private IP environments. By enabling Private Google Access and routing Cloud Storage object creation events to a Pub/Sub topic, you decouple storage from processing. A Cloud Function subscribed to the Pub/Sub topic can then securely trigger the DAG without requiring direct VPC-level connectivity to the Airflow web server.Why the Other Options Are Wrong
Options C and D propose triggering the Airflow REST API directly from a Cloud Function. While technically viable in public or standard VPC setups, Google’s documentation explicitly notes this pattern fails in Private IP environments due to unresolvable internal endpoints and blocked egress. Option B incorrectly references the Cloud Composer API instead of leveraging event-driven Pub/Sub messaging, which is the standard scalable pattern for file-based triggers.Community Comment Notes
Multiple high-voted comments ([2], [3], [7]) correctly cite official Google Cloud documentation confirming that direct GCF-to-Airflow triggers are unsupported in Private environments. Users emphasize that Pub/Sub acts as the necessary reliable bridge, making A the only architecturally sound choice under strict network isolation constraints. The consensus strongly favors A over C/D despite initial intuitive appeals to direct API calling.Official Reference
Exam Strategy
Always map explicit network constraints (like 'no Internet access' or 'Private IP') to Google’s supported integration patterns before selecting direct service-to-service options. When a question restricts outbound connectivity, default to managed message brokers like Pub/Sub as intermediaries rather than forcing direct REST API calls.