Skip to main content

Posts

REST API Pagination: Design the Continuation Link Before You Choose Offset or Keyset

When a list endpoint starts returning too many rows, the first question is usually "offset or keyset?" That question comes second. The first is: can the pagination strategy change later without breaking a single client? If the answer is no, the SQL is the smaller decision, because the response shape has already locked you in. This guide is a decision analysis for C#, SQL Server and REST APIs, built on documentation from Microsoft. No benchmarks are claimed. Paging is a contract change before it is a query change Microsoft's API guidance recommends supporting paging whenever a collection could grow large, and Azure's own API tooling notes that designing pagination up front avoids a later breaking change when continuation links have to be added. That matches how clients behave. A client handed a bare array has no way to know a second page exists, so it silently processes a truncated list. Three criteria, in order: Can the client discover that more data exists? ...
Recent posts

Can S3 Be a System of Record? Durability, Consistency and Conditional Writes

Can a bucket be your system of record? The answer depends on which failure you are worried about. Eleven nines of durability answers "will the bytes survive hardware loss?" It says nothing about two writers racing on one key, or a job that overwrites last night's good file with tonight's bad one. This guide separates those failures and maps each to an S3 control, based on AWS documentation. Four questions decide it, and durability answers only one Before choosing S3 over a database, ask: Will stored bytes survive infrastructure failure? The durability question. Will a reader see the latest write? The consistency question. When two writers collide, who wins, and does the loser find out? The concurrency question. Can a person or a buggy job destroy good data, and can it be recovered? The retention question. S3 answers the first two by default. The last two are answered only if you configure or code for them. That gap is why "S3 is a database" i...

Lambda Container Images and Architecture Mismatches: Build for One Platform, Verify Before Deploy

If a Lambda function can be cheaper by changing one field, why does the change sometimes fail at deploy time or on the first invoke? For container-image functions, the field is not the hard part. The architecture is now a property of two separate things, the function configuration and the image, and the pipeline has to keep them in agreement. Whether arm64 is worth it for a given function, including the price difference and the compatibility checklist, is covered in AWS Lambda ARM64 Container Images: Should You Build for Graviton or x86_64? . This guide covers the part after that decision: making sure what you build is what you deploy. A container function has two architecture declarations Where What it declares Default when unspecified Function configuration The Architectures setting: exactly one value x86_64 The image The platform it was built for, decided by the build host, base image and build flags Whatever machine ran the build The Lambda documentation says the...

Lambda in a VPC: What the NAT Gateway Really Costs and How to Avoid It

What does a Lambda function pay for the privilege of being inside a VPC? Nothing at first. The cost arrives when the function needs to reach something outside the VPC, which usually means a NAT gateway, and a NAT gateway carries two separate meters. This guide is a decision analysis built on AWS documentation and pricing pages, with the questions in order: does the function need VPC access at all, what does it call once it is attached, and does each of those calls need a public path or a private one? Start by asking whether the function needs the VPC By default, a Lambda function runs in a Lambda-managed VPC that has internet access. Attaching a function to your own VPC restricts it to that VPC's resources unless you arrange outbound access yourself. The usual reason to attach is a private resource, such as a database or an internal API. If a function only calls public AWS APIs and a few third-party endpoints, attaching it creates a networking problem it did not have before. T...

Step Functions or Plain Code? A Decision Framework for Small Workflows

Here is a question worth asking before adding a state machine to any small product: if the process running step three of five dies right now, what knows that steps one and two already happened? If the honest answer is "a row I wrote myself" or "nothing", there is a durability problem. If the answer is "nothing, and that is fine because every step is cheap to repeat", an orchestrator is probably unnecessary. This guide is a decision analysis rather than a migration report. It lays out the criteria for choosing between orchestration in code and AWS Step Functions, checked against AWS documentation. The test is what survives a crash, not how many steps you have Step count is a poor signal. A five-step flow where every step is idempotent and finishes in seconds is easy to write as plain code. The signals that matter are about time and memory: Does the flow outlive one invocation? A Lambda invocation is capped at 15 minutes, while a Standard workflow ca...

Retry Multiplication in AWS: How Lambda and SDK Retries Stack Up

How many times does one failed downstream call actually get attempted? If you cannot answer that for your own services without opening three consoles, you probably have a retry multiplier you did not choose. This guide is a reasoning exercise with documented defaults, not an incident report: the arithmetic the defaults make possible, and the decisions worth making about it. For every hop in a call chain, four things should be known: who owns the retry, how many attempts it makes, whether it backs off, and whether the work is safe to repeat. If two layers both answer "I do", the attempts multiply instead of adding. Two reasonable defaults that together form a multiplier Take a Lambda function invoked asynchronously that calls another service through an AWS SDK client. Both layers have their own retry behavior. Layer Default behavior Worst-case attempts Lambda asynchronous invocation A failed invocation is retried up to two more times 3 handler runs AWS SDK clie...

API Gateway Validation, Lambda Authorizers and Handlers: Where Each Check Belongs

A request arrives with a valid token, a malformed JSON body and a path the caller has no business touching. Which component should reject it, and what does each rejection cost? In an API Gateway plus Lambda design there are three candidates: the gateway's request validation, the Lambda authorizer and your handler. Each can say "no", but each can only reason about different information. This guide is a design analysis based on AWS documentation, built around four questions: What information does the check need? Header presence, body shape, caller identity and the target resource's owner are four different inputs. What does a rejection cost? A rejection at the gateway never invokes your code. A rejection in the handler pays for an invocation. How widely is the result cached? A cached decision is only correct if it holds for everything it covers. Who changes the rule, and how fast must a change take effect? Revoking access is a different problem from tightening...