Troubleshooting, data APIs, and LLMs
DEA-C01 · Lesson 4 of 23 · 24:33
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the DEA-C01 exam (AWS Certified Data Engineer – Associate). In this lesson: out of memory errors, data skew, and timeouts, Glue job run insights, filtering early, pushdown predicates, and fewer shuffles, data APIs with API Gateway, the Redshift Data API, and the Athena API, large language models in Amazon Bedrock called from Lambda, Glue, or Redshift, batch inference, and a method to debug with logs, a small sample, and one change at a time. Includes three original practice questions.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
A difficult Monday
On Monday morning, a nightly Glue job of AnyCompany Games failed with an out of memory error, another job ran for nine hours instead of one, and a partner team asks for an API to read the daily player counts. Meanwhile, product managers want thousands of player reviews in twelve languages sorted by topic. This lesson covers how to troubleshoot transformations, make jobs faster, share data through APIs, and process data with large language models.
Common failures
Most failures fall into a few families. An out of memory error often comes from the driver, when it tracks too many small files or collects too much data, so group the files, keep the work on the executors, or choose a larger worker type. Data skew means that a few keys hold most of the rows, so a few tasks run for hours while the others wait: repartition the data, or salt the hot keys. A timeout stops a job that runs longer than its limit, which defaults to eight hours in recent Glue versions, so set it from the expected runtime. And AWS Glue job run insights points to the failing line of your script, with the root cause and a recommended action.
Faster code
To reduce the runtime, read less and move less. Filter early: select only the columns and rows that you need at the start of the job, not at the end. With a pushdown predicate, Glue reads only the matching partitions of a catalog table, and a catalog partition predicate filters them on the server side, with partition indexes. Joins and group by operations shuffle data between executors, which is costly, so broadcast a small table to every executor rather than shuffling a big one. And watch the Spark UI and the job metrics, to see which stage takes the time.
Data APIs
Other systems often need data through an API, not through files. Amazon API Gateway publishes REST and HTTP APIs, and a Lambda function behind them reads DynamoDB for single items in milliseconds, or runs an Athena query for larger questions. The Amazon Redshift Data API runs SQL over HTTPS, without drivers or persistent connections, and it runs asynchronously: you submit a statement, then you fetch the result. Athena works the same way through its own API: start a query, check its status, then read the results from S3. Protect each API with IAM or tokens, and with throttling limits, so that one client cannot overload the store.
Large language models
Large language models can process text that rules cannot handle, like sorting player reviews by topic, pulling fields out of support tickets, or translating them. Amazon Bedrock gives access to models from several providers through one API, and a Lambda function or a Glue job can call it for each record. For large volumes that are not urgent, Bedrock batch inference reads prompts from files in S3, writes the answers back to S3, and costs half the on-demand price for the models that support it. Redshift can call a Bedrock model from SQL, after a create external model command, and Bedrock Data Automation pulls content out of documents, images, audio, and video. Ask the model for a fixed output, like JSON with a short list of labels, and check a sample of its answers, because a model can be wrong.
A troubleshooting method
When a transformation fails, start with the facts. Read the error and the failing line in the job logs in CloudWatch, then compare the input with the last good run: a new column, a bad file, or a sudden jump in volume. Run the job again on a small sample of the data to reproduce the error quickly, and change one thing at a time. And once it works, add a check that would have caught the problem, like a row count or a schema check before the write.
Recap
Let's recap. Out of memory errors, data skew, and timeouts are common failures, and job run insights shows the root cause. Filter early, use pushdown predicates, and limit shuffles to reduce the runtime. API Gateway, the Redshift Data API, and the Athena API make data available to other systems. Bedrock calls models from Lambda, Glue, or Redshift, and batch inference processes large volumes for less. And debug with the logs, a small sample, and one change at a time.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
A Glue job reads three years of game events, partitioned by date in the Data Catalog, but it uses only yesterday's partition, which it filters at the end of the script. The job runs for two hours. What should the data engineer do first?
- Add a pushdown predicate on the date partition
- Run the job with the Flex execution class
- Raise the job timeout to six hours
- Give the job twice as many workers
Show the answer
Add a pushdown predicate on the date partition
With a pushdown predicate, Glue lists and reads only the partition of yesterday, instead of three years of files. “Run the job with the Flex execution class” would cost less, but the job would still read everything. “Raise the job timeout to six hours” would only let a slow job run longer. And “Give the job twice as many workers” would spread the same useless reading over more workers.
Each week, AnyCompany Games must sort two million player reviews by topic with a large language model. Results are needed by Monday, not in real time. What is the most cost-effective approach?
- A Lambda function that calls the model for each review
- Provisioned throughput for the model all week
- A streaming pipeline that calls the model in real time
- Bedrock batch inference with prompts stored in S3
Show the answer
Bedrock batch inference with prompts stored in S3
Batch inference processes prompts from S3 asynchronously, at half the on-demand price of the models that support it. “A Lambda function that calls the model for each review” would pay the on-demand price for two million calls, and would have to handle throttling itself. “Provisioned throughput for the model all week” is for steady traffic that needs reserved capacity, and it costs money all week. And “A streaming pipeline that calls the model in real time” would pay for real time, which nobody needs here.
A Glue job that sums purchases by player has 199 tasks that finish in minutes and one task that runs for three hours. A handful of test accounts hold most of the purchases. What is the cause?
- The timeout of the job is too short
- Data skew on the player key
- Too few workers allocated to the job
- Job bookmarks are not enabled
Show the answer
Data skew on the player key
A few keys hold most of the rows, so one task gets most of the work, which is data skew. “The timeout of the job is too short” would stop the job, not slow down a single task. “Too few workers allocated to the job” would slow every task, not just one. And “Job bookmarks are not enabled” would make the job read old data again, on every task.