How nasa-impact/veda-data-airflow works
Project type and purpose
• This is a data-pipeline orchestration project (“veda-data-airflow”) that uses Apache Airflow to run ETL pipelines producing cloud-optimized raster and vector data products and STAC metadata, deployed to AWS via Terraform. It also contains a small Lambda-based “workflows_api” for ingestion APIs, and a local SM2A development environment (Airflow webserver + workers) for testing.
High-level components
a. Airflow orchestration layer
• AWS Managed Workflows for Apache Airflow (MWAA)
– Scheduler & Webserver
– Worker fleet (runs PythonOperator tasks, ECS/ DockerOperator tasks)
– DAGs source location (S3 bucket)
– Plugins & requirements (packaged and uploaded to S3)
• Local SM2A setup (for local development)
– Docker Compose services: webserver, scheduler, workers, metadata DB
b. Execution layer
• Python DAGs (in-process tasks)
• Docker-based tasks (build_stac, cogify_transfer, vector_ingest) executed via DockerOperator/ECS TaskDefinitions
• AWS Lambda functions
– S3 event → EventBridge → Lambda trigger → kicks off Airflow DAG or Step Function
– workflows_api Lambda behind API Gateway (ingest API)
c. Data storage & metadata
• S3 buckets
– Raw source buckets (input files)
– Transformed output (COG, GeoJSON, STAC JSON)
– DAG definitions & plugins (for MWAA)
• RDS (metadata database for Airflow metastore / SM2A metadata DB)
• (Optionally) CloudFront distribution for invalidation
d. Infrastructure as Code
• Terraform modules
– MWAA environment (environment variables, execution role, network settings)
– IAM roles and custom policies
– S3 buckets, RDS instance, EventBridge rules, Lambda functions, ECS TaskDefinitions
– Outputs for integration (e.g., Cognito client IDs)
e. External services
• AWS Cognito (for workflows_api auth)
• API Gateway (fronting workflows_api Lambda)
• Optional services: SNS/Slack (notifications), CloudWatch logs/metrics
Relationships and data flows
• Data ingestion triggers:
• Manual/API trigger → workflows_api Lambda → writes message to SQS or directly calls Airflow REST → starts DAG
• S3 put events → EventBridge → S3-to-StepFunction/Lambda → triggers DAG run in MWAA
• DAG orchestration:
• Scheduler reads DAG definitions from S3 → schedules tasks
• PythonOperator tasks run in MWAA worker containers → read/write S3, call AWS SDK, write metadata to RDS
• DockerOperator/ECS tasks pull images from registry (built via docker_tasks/) → perform CPU-intensive transforms → upload results to S3
• Metadata & state:
• Airflow metadata in RDS
• Pipeline metadata written by tasks into SM2A metadata DB (RDS)
• Monitoring & notifications:
• CloudWatch metrics & logs from MWAA
• Slack notifications via Python hook in DAGs
Architectural patterns & principles
• Orchestration vs. execution separation: Airflow schedules and monitors, heavy work done in isolated Docker tasks or Lambdas
• Infrastructure as code: all AWS resources managed via Terraform with reusable modules
• Event-driven triggers: use of EventBridge + Lambda to kick off pipelines on S3 events
• Modular DAG design: dags/veda_data_pipeline organized into groups (collect, discover, transfer, processing)
• Extensibility points: Docker tasks folder for custom containers, plugin folder for custom Airflow operators