For selected PySpark jobs, I wanted to change the execution engine while preserving the application and data contracts. Airflow would still orchestrate the work, the AWS Glue Data Catalog would supply metadata, and S3 with Delta Lake would remain the data plane. Data engineers would keep working with the same application logic.

That approach is now in production for selected jobs, and the developer handover is complete. I owned the migration work across application compatibility, Airflow integration, Kubernetes capacity, runtime images, CI/CD, validation, and handover. The engineering challenge was connecting those pieces into a platform developers could operate.

The measurements also stopped us from treating this as a universal replacement for Glue. Workload shape mattered: scan-oriented and shuffle-heavy jobs benefited from different capacity profiles, while smaller jobs could be less economical on a distributed Spark deployment. The useful outcome was a way to choose the execution environment per job.

Preserve the job contract

We already operated EKS and Karpenter. Moving selected PySpark workloads there gave us direct control over instance families, Spot capacity, local scratch storage, scheduling, and capacity release. That control came with responsibility for runtime compatibility, observability, releases, and operational ownership.

The integration point was our existing Airflow job factory. Each job could select an execution engine. The Glue path remained available; the Spark path submitted a SparkApplication to the Spark Operator on EKS. Both paths converged on the existing downstream completion logic for crawlers, statistics, dataset publication, and dependent work.

Airflow job factory
  ├─ Glue execution
  └─ SparkApplication → Spark Operator → driver and executors
                                           ↓
                                  Karpenter-managed capacity

Shared contracts: Glue Data Catalog · S3 · Delta Lake
Shared orchestration: dependencies · completion handling · dataset publication

Keeping engine selection per job let us separate application compatibility from migration. A job could become Spark-capable before its scheduled execution changed. That made it possible to validate and tune individual workloads without forcing the entire platform through the same transition.

Portability came from a narrow compatibility layer

The initial jobs mostly used ordinary PySpark DataFrames. Their important Glue integration was table lookup through GlueContext; the migration set did not materially depend on DynamicFrames or Glue bookmarks. That inventory shaped the implementation.

We built a narrow compatibility shim: look up the database and table through the Glue Data Catalog API, extract the S3 location, read the Delta table, and return a Spark DataFrame. It supported the behavior our jobs used. Unsupported Glue-specific behavior needed to fail clearly rather than appear compatible.

A generic launcher received a Python module-and-class reference, loaded the job, created its Spark session and compatibility context, and invoked its standard execution method. The image packaged the application wheel and the Spark, Delta, Hadoop AWS, and Python dependencies together. Their compatibility became a tested release concern instead of a property inherited from the managed runtime.

Let workload measurements choose the capacity

Spark, the operator, and Karpenter perform different jobs. Spark manages executor demand; the operator manages application lifecycle; Karpenter provisions capacity for pending pods. Resource requests, dynamic allocation, and scheduling constraints need to agree for that arrangement to work efficiently.

We placed drivers on on-demand capacity and used Spot primarily for executors. Losing the driver has a different consequence from replacing an executor. Executor decommissioning and shuffle handling were therefore part of the configuration, alongside the capacity choices.

  • General profile: multi-AZ Spot capacity for scans, filters, ordinary transformations, and lighter spill, using general-purpose or memory-oriented instances with gp3 scratch storage.
  • Shuffle profile: storage-optimized Spot instances with local NVMe for workloads dominated by joins, aggregations, sorting, and sustained spill, with capacity concentrated in one AZ.

These profiles came from running actual PySpark jobs and comparing runtime, resource behavior, and modeled costs. A scan-heavy workload did not automatically benefit from the infrastructure that suited a shuffle-heavy one. Treating every large job as the same infrastructure problem would have hidden that distinction.

The single-AZ choice aimed to reduce cross-AZ transfer costs during shuffle and improve communication locality. It also narrowed available capacity and concentrated failure exposure. Local NVMe is temporary, host-attached storage; it does not follow an executor to another node, even within the same AZ.

Karpenter currently handles capacity provisioning within the configured constraints. A pool pinned to one AZ cannot automatically become resilient across AZs: the allowed zones still govern where replacement nodes can be created. Our proposed Airflow retry flow that chooses alternative capacity groups is planned, not implemented. These are separate layers of recovery.

Capacity release mattered too. Short workloads can finish while their nodes remain billable. We tuned consolidation alongside executor sizing, because workload duration alone does not describe the infrastructure lifetime it creates.

What the cost comparisons can establish

The internal comparisons helped identify promising migration candidates and choose their profiles. I am keeping company-specific prices, volumes, and savings estimates private. The transferable finding is that large recurring workloads and small occasional jobs can have very different economics on the same platform.

For some small jobs, startup and minimum deployment shape outweighed the benefit of the alternative compute. For larger workloads, resource behavior and recurring execution made capacity tuning more consequential. Row count alone was a poor guide: shuffle, spill, skew, runtime, and scheduling frequency explained more about where to investigate.

These were workload-level cost models used to guide engineering decisions. They should not be read as an audited comparison of total platform ownership. Such a comparison needs explicit treatment of startup and idle capacity, drivers, shared infrastructure, storage, network transfer, monitoring, retries, and engineering effort. A lower modeled compute cost is useful evidence, but it does not settle all those questions.

The most useful correctness lesson was source drift

An early parity comparison found a small difference between outputs from Glue and Spark. The apparent similarity was encouraging, but the runs had read a source at different times. The source changed between them.

That made the result inconclusive as an engine comparison. The discrepancy could not be attributed to the runtime from those runs alone, and a small percentage difference did not prove correctness. The first question became whether both executions had processed the same input.

The validation protocol I would recommend starts with a fixed snapshot or suitable time-travel input, followed by schema and type checks, row counts, key uniqueness, anti-joins in both directions, deterministic value comparisons, business aggregates, and relevant Delta metadata checks. The original drifting-source comparison remains a lesson about test design, not proof that every possible output difference was resolved.

Shared data contracts also require writer coordination. Glue and Spark must not accidentally write the same production target concurrently, and a retry must account for any application still running from the previous attempt. That requirement belongs in migration and operating procedures; retaining two submission paths does not itself solve it.

Make the runtime reproducible and the permissions explicit

DevOps manages the Spark base image through a dedicated CI/CD pipeline with unit tests. Packaging runtime dependencies and application code together gives troubleshooting a concrete artifact: which code and dependency set produced this output? The earlier local validation workflow exercised the branch image through Airflow, submitted it to an isolated namespace, and redirected outputs to sandbox storage.

That workflow tested the integration across Airflow, Kubernetes, Spark, S3, and the Catalog. It was a useful step toward production, but could not substitute for validating the production scheduler’s identity, network access, release configuration, and operating ownership. The subsequent production migration and developer handover extended the work beyond that initial validation environment.

We separated the developer’s submission identity from the Spark runtime identity. In the validation environment, the runtime could read approved inputs and Catalog metadata while writes were scoped to sandbox outputs and event logs. The distinction helped make permissions reviewable.

Submission permission still deserves careful treatment: code launched under a service account can exercise that account’s access. A managed base image and CI tests establish release controls; they do not, on their own, establish that a submitter cannot override image or service-account fields. Those are workload-authorization questions that must be assessed separately.

Observe the job after its pods disappear

The observability design followed the failure path across systems. An Airflow failure might originate in application logic, operator submission, pending executors, memory pressure, or unavailable capacity. A useful investigation needed those layers in view together.

  • Airflow outcomes: a durable terminal-run metric carrying job, execution engine, and status, so completed or failed applications remain visible after their pods disappear.
  • Spark Operator health: submission failures, reconciliation errors, queue behavior, and application start latency.
  • Spark behavior: live executor, memory, task, stage, and shuffle metrics, together with persisted event logs available through the Spark History Server.
  • Kubernetes and Karpenter: pending pods, scheduling constraints, resource pressure, node provisioning, and capacity release.

Driver and executor logs supplied the application detail behind those signals. Persisted event logs were especially useful because the live Spark UI and metrics endpoints stop when the driver exits. Metrics already exported to a monitoring system can remain available under that system’s retention policy. Run-level outcomes and historical diagnostics served different purposes; both were needed.

We also separated platform health from data-product health. An available operator and a successful Spark application do not establish that a dataset is fresh, correct, or useful to its consumer. Those expectations need ownership and checks at the job and data-product level.

The handover is part of the platform

The completed implementation now runs selected production jobs on self-managed Spark on EKS, with the developer handover complete. My ownership extended through the infrastructure and application integration to the validation workflow and documentation developers needed to use it. Release review and ongoing platform operation remain collaborative responsibilities.

The sequence I would recommend is straightforward: inventory the job contract, add runtime compatibility, test on controlled inputs, measure actual resource behavior, choose a capacity profile, validate production integration, and hand over the operating workflow. Each step answers a different question; a successful Spark submission answers only one of them.

For platform engineers, the central design choice was preserving the surrounding contracts while making compute selectable. For engineering leaders, the corresponding commitment is operational ownership: runtime releases, capacity behavior, access, observability, and developer support become part of the platform’s work. That is the responsibility we took on when we moved these jobs to EKS.