|
Lambda Durable Functions makes it easy to implement business workflows using plain Lambda functions. Besides the intended use cases, they also let us implement ETL jobs without needing recursions or Step Functions. Many long-running ETL jobs have a time-consuming, sequential steps that cannot be easily parallelised. For example:
Historically, Lambda was not a good fit for these workloads because of its max 15 mins execution time. However, that's no longer a problem with Lambda Durable Functions because a "durable execution" can run for up to a year. BUT, you're still limited by the 15 mins execution time for individual invocations. So the trick is to use context.wait to slice the long-running durable execution into many invocations, each fits comfortably inside the 15 mins execution time limit. This works because every time you do context.wait, the durable execution exits and re-invokes the function after the specified time has passed (see below). Take the following code for example. The items need to be processed in order. Collectively, they might take more than 15 mins to process. However, by breaking them into more manageable batches, we ensure that each batch can be finished within the 15 mins limit. At the end of each batch, we use context.wait to exit the durable execution. The function is re-invoked after the 1 second delay and continues onto the next batch. Each batch is given a unique step name, so on replay, the system can fetch the correct result from the previous invocation. This also helps us understand what's going on when we look at the audit history. This is a nice pattern (no need for risky recursions!) and very easy to implement. However, there are a few things to keep in mind:
I hope you're experimenting with Lambda Durable Functions and I love to hear how you're using it. It's one of the best additions to Lambda in years! |
Join 17K readers and level up you AWS game with just 5 mins a week.
Modern applications rarely do just one thing at a time. An API request creates an order, and then another service needs to reserve stock, another to charge the customer, another to send an email, and so on. In a serverless or event-driven architecture, follow-up actions are usually triggered by messages (either events or commands). That gives us loose coupling, better scalability, and independent services. But it also introduces a reliability problem. “What happens when the database update...
If you use Claude Code a lot, you’ve probably run into usage limits, sometimes even in short coding sessions. But cost isn’t the only problem. In long-running sessions, the context window eventually fills up, and that can cause the agent to forget earlier decisions, lose important details, or come back from compaction with gaps in its working memory. Here are three tools worth checking out if you want to reduce token usage and make longer coding sessions possible. 1. CavemanThis is a Claude...
AI agents can now scan an entire open-source codebase for exploitable vulnerabilities in hours. Frontier models carry the complete library of known bug classes in their weights. So you can simply point an AI agent at a codebase and tell it to find zero-days. This isn't theoretical. Willy Tarreau, the HAProxy lead developer, reports that security bug reports have jumped from 2–3 per week to 5–10 per day. Greg Kroah-Hartman, the Linux kernel maintainer, described what happened: "Months ago, we...