How nasa/cumulus-orca works
Project type and purpose
• ORCA is a full‐stack cloud backup and recovery solution built on AWS.
• It combines infrastructure-as-code (Terraform), containerized services (GraphQL API on ECS), serverless Step Functions & Lambdas, databases (Postgres), object storage (S3), and CI/CD (Bamboo, Docker).
• Primary use cases:
• Copy data to deep-archive buckets
• Request and restore backups
• Perform and report internal reconciliation
• Execute recovery workflows
Top-level architectural components
• Terraform modules (in modules/…, main.tf, variables.tf, outputs.tf): define VPC, IAM roles, S3 buckets, API Gateway, ECS cluster, Lambda functions, SQS queues, CloudWatch Events, Step Functions workflows.
• GraphQL service (in graphql/): FastAPI + Ariadne-style GraphQL server packaged in Docker, deployed to ECS behind API Gateway.
• ECS tasks (in ecs_tasks/internal_reconcile_report_generate/): containerized batch jobs for internal reporting.
• Serverless tasks (in tasks/…): dozens of individual Lambda handlers for single‐purpose functions (copy_to_archive, request_from_archive, post_to_catalog, etc.), triggered via Step Functions, SQS, or API Gateway.
• Shared libraries (in shared_libraries/): common code (database connection, reconciliation & recovery helpers) imported by multiple tasks.
• State machines / workflows (in modules/workflows/…): Step Functions definitions for high-level workflows (OrcaCopyToArchive, OrcaInternalReconciliation, OrcaRecoveryWorkflow).
• Database: Amazon Aurora Serverless (Postgres) accessed by GraphQL and Lambdas.
• Object storage: multiple S3 buckets (archive, DR buckets), defined in Terraform.
• CI/CD: Bamboo specs under bamboo-specs/, plus Dockerfiles in base_images/, graphql/, and build scripts in bin/ and lambda scripts/.
Relationships and dataflow
a. API Layer
• API Gateway (Terraform) → GraphQL ECS service → invokes use‐case code → queries Postgres or fetches metadata from S3 → returns GraphQL responses.
b. Orchestration Layer
• Step Functions definitions (State Machines) orchestrate multiple Lambda tasks from tasks/….
• Each Step Function state (Task) invokes a Lambda ► reads/writes to S3 & Postgres ► passes output to next state.
c. Batch / Scheduled Jobs
• ECS Tasks (internal_reconcile_report_generate) run on CloudWatch schedule (or ECS scheduled tasks) to produce reports, storing results back to S3 / Postgres.
d. Event & Queueing
• Some flows use SQS (modules/sqs/) to buffer or fan-out copy requests or reconciliation notifications to Lambdas.
e. Shared code
• All Lambdas and containers import common logic from shared_libraries/orca_shared and shared_libraries/orca_shared/database.
Architectural patterns & principles
• Clean Architecture in Python services: clear separation of
• Entities (business objects)
• Use Cases (application logic)
• Adapters (API, storage, logger)
• Infrastructure-as-Code (IaC) using Terraform modules for repeatability and environment isolation.
• Microservices & Serverless: single-purpose Lambda functions combined into Step Functions workflows.
• Containerized API: GraphQL service in Docker/ECS for a persistent API endpoint.
• CI/CD Pipelines with Bamboo and Docker images to build, test, and deploy artifacts.