> ## Documentation Index
> Fetch the complete documentation index at: https://help.nops.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Use Flex Execution for Non-Production Glue Jobs

> Run non-production AWS Glue ETL jobs with the Flex execution class, which costs less per DPU-hour.

AWS Glue Flex runs Spark ETL jobs on spare capacity at a lower price per DPU-hour than the standard execution class. Jobs may start later and take longer, which is usually fine outside production. nOps finds Glue jobs that run in non-production and estimates the saving from switching them to Flex.

| | |
| - | - |
| **Cloud** | AWS |
| **Category** | Analytics |
| **Service** | AWS Glue |
| **Action** | Modify |
| **Effort** | Low |
| **Restart needed** | No |
| **Can be rolled back** | Yes |
| **Analysis window** | Last 7 days |
| **Source** | nOps |

## Why it matters

Development and test pipelines are often copied from production with the standard execution class, although nobody needs them to start the moment they are scheduled.

## How nOps finds it

nOps reads the last 7 complete days of Glue job-run billing for standard ETL DPU-hours. A job is flagged when at least 90% of its cost is non-production, judged from its environment tag, then the environment nOps assigns, then words in the job name (dev, test, staging, QA, sandbox, UAT, demo and similar). Jobs billed at least 22 hours on every one of the 7 days are treated as streaming and left out. The saving is the job's cost times the difference between the Flex and standard list prices for the region. Savings under \$10 a month are not shown.

## Before you start

A Glue 3.0 or later Spark ETL job (not Python shell or streaming), and permission to update it (`glue:UpdateJob`).

## How to implement

1. Confirm the job is a Spark ETL job on Glue 3.0 or later and has no strict completion deadline.
2. In the Glue console, open the job, go to **Job details**, and set **Flex execution** on, or pass `--execution-class FLEX` to `aws glue start-job-run` or set `ExecutionClass` on the job.
3. Run it once and check the run time is acceptable.
4. Update the job definition in Terraform, CloudFormation or your deployment scripts.

## Risks and considerations

* Flex runs can start later and run longer, and a run can be interrupted and retried.
* Do not use Flex for jobs that feed time-sensitive production processes.
* To roll back, set the execution class back to standard.

## FAQs

> [accordion] How does nOps know a job is non-production?
>
> From its environment tag first, then the environment nOps assigns to the account, then words such as dev, test or staging in the job name.

## Related

* [Use FlexRS for Delay-Tolerant Dataflow Batch Jobs](https://help.nops.io/inform/supported-recommendations/use-flexrs-for-delay-tolerant-dataflow-batch-jobs)
* [Run EMR Task Nodes on Spot Instances](https://help.nops.io/inform/supported-recommendations/run-emr-task-nodes-on-spot-instances)
* [Supported recommendations](https://help.nops.io/inform/supported-recommendations.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.