October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk6 min

AWS Serverless Architecture: Patterns to Choose and Anti-Patterns to Avoid

Choose AWS serverless architecture by the shape of the work: immediate API responses, buffered jobs, independent event reactions, streams, or coordinated workflows. Plan for duplicate delivery, durable state, concurrency, and recovery.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose an AWS serverless pattern by asking whether the caller needs an immediate result, how long the work lasts, how many consumers need to react, and what happens when processing fails. Use API Gateway and Lambda for request-and-response work; SQS when work can wait in a queue; SNS or EventBridge when events need to reach other components; Kinesis for event streams; and Step Functions or Lambda durable functions when a process needs explicit multi-step coordination. Whatever the shape, plan for retries, duplicate delivery, concurrency, permissions, and durable state.

How to choose an AWS serverless pattern

Start with the work, not the function count. A short, independent task may fit one Lambda function. A request that needs an immediate answer may be synchronous. Work that can continue after the caller receives a response can be asynchronous. If several steps, branches, waits, or recovery actions need coordination, make that workflow explicit rather than hiding it in a chain of function calls.

As an Amazon Associate I earn from qualifying purchases.

Need Common AWS building block Useful when
Handle API requests Amazon API Gateway A caller needs to invoke application logic through an API.
Buffer work between producers and consumers Amazon SQS The producer should be decoupled from processing that can happen later.
Publish and subscribe Amazon SNS A message needs to be published for subscribers to receive.
Route events Amazon EventBridge Components need an event bus to connect event producers and consumers.
Coordinate a multi-step process AWS Step Functions or Lambda durable functions Steps, branches, waits, retries, or recovery should be managed as a workflow.
Work with event streams Amazon Kinesis The application needs an event-stream building block.

These are common mappings, not interchangeable defaults. Choose based on response latency, duration, delivery and ordering needs, throughput, failure handling, and the amount of operational coordination the workload requires.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When should you use each pattern?

API Gateway and Lambda for immediate responses

Use a synchronous API when the caller needs the result before proceeding and the end-to-end work fits the relevant service limits. Keep the function focused on a cohesive task and return a response that answers the caller’s request. If the operation involves lengthy processing or several dependent services, a chain of synchronous waits can make the request vulnerable to timeouts and complicate retries.

Lambda with SQS for buffered, asynchronous work

Use a queue when the producer does not need to wait for a consumer to finish. The producer can submit work and return a job reference or status path; the consumer processes queued work separately. This separates the timing of request acceptance from the timing of completion and can help absorb bursts, but it does not make downstream capacity unlimited. Set concurrency and other controls according to what the consumer and its dependencies can handle.

Design the consumer for retries and duplicate delivery. Consider what should happen when processing repeatedly fails, including an appropriate recovery or dead-letter approach for the workload. The caller-facing API should distinguish accepted work from completed work rather than implying that a queued job has already finished.

SNS or EventBridge when components should react independently

Use publish/subscribe or an event bus when a producer should announce something that other components can handle independently. This is useful for separate business reactions that do not all need to finish before the producer continues. Keep event ownership clear: identify which component publishes each event, which consumers act on it, and how each consumer handles failure. Decoupling reduces direct timing dependencies, but it does not remove the need to monitor delivery and processing.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Kinesis for event-stream workloads

Use Kinesis when the application’s work is shaped as an event stream. It is the AWS service mapping for event streams in Lambda application-design guidance. The stream choice should reflect the workload’s delivery, ordering, throughput, and consumer requirements; the available guidance does not establish one stream configuration as right for every application.

Step Functions or durable functions for coordinated workflows

Use an orchestrator when a process has multiple steps, conditions, waits, retries, or recovery behavior that should be visible and managed outside a single function invocation. AWS’s Serverless Applications Lens states, “Orchestrate your application with state machines, not functions.” Step Functions and Lambda durable functions are AWS orchestration options; which fits depends on the workflow and its requirements.

A direct Lambda-to-Lambda call can be reasonable for a simple, deliberate dependency. It becomes a poor substitute for orchestration when each function call implicitly represents a workflow step and the application code must manage branching, retries, errors, and progress itself.

Make retries safe with idempotent operations

For event-triggered work, assume an operation may be delivered more than once. Lambda event source mappings can process events at least once, so retries can result in duplicate processing. A handler is idempotent when repeating the same logical operation has the same net effect as doing it once—for example, it does not charge twice or create duplicate records.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a stable key tied to the operation

For a state-changing request, use a stable business or request identifier to recognize a repeat and prevent the side effect from being applied again. AWS Well-Architected guidance describes idempotency tokens as one way to handle repeated mutating requests safely. Avoid timestamps as idempotency keys: clock skew and collisions can make them unreliable. Generate and use the key consistently.

Match the safeguard to the risk

Idempotency does not require storing an entire request payload for every operation, and it need not be added where repeated execution cannot cause a meaningful problem. Focus the protection on the side effects that matter, and make the repeated-request behavior explicit.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common AWS serverless anti-patterns

One Lambda monolith for every route or event

A single function that contains all application logic can grow into a larger package, make least-privilege permissions harder to apply, and increase complexity. Split functions around cohesive responsibilities and meaningful deployment or security boundaries—not mechanically into one function per line of code. The goal is isolation that improves maintainability or control without needless fragmentation.

Function chains acting as an invisible workflow engine

When functions call other functions to coordinate a multi-step transaction, retry and error behavior can become scattered through application code, while workflow progress is harder to see. Move coordination to a state machine or durable workflow when the process needs managed steps, branches, waits, or recovery. This is a design preference, not a ban on every direct function call.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Non-idempotent handlers

A handler that repeats a charge, writes another record, or repeats another side effect after a retry is unsafe for at-least-once processing. Build duplicate protection around the operation’s stable identity instead of assuming an event will arrive exactly once.

Recursive event loops and uncontrolled feedback

A function can trigger a process that causes the same function to run again. Such feedback can multiply invocations and cost. Define producer and consumer boundaries, use filters or guards where needed, and monitor invocation volume. If unintended invocation volume is escalating during an incident, AWS identifies setting reserved concurrency to zero as an immediate throttle response; it is an incident action, not a routine design setting.

Long synchronous wait chains

When a caller waits through several dependent calls or a long-running process, the request can time out and leave retry behavior difficult to manage. Put coordination in a workflow service where appropriate, and let the caller check status or receive updates asynchronously instead of holding the original request open for every step.

Letting Lambda scale past downstream capacity

Lambda concurrency can exceed what a database or external API can handle. Know the throughput constraints of upstream and downstream systems, then use controls such as reserved concurrency, buffering, or backoff when the workload calls for them. These are workload-specific safeguards, not settings every function needs by default.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep state durable and responsibilities narrow

Lambda execution environments are not guaranteed to persist. Do not treat local resources as durable application state; put information that must survive execution in persistent storage suited to the requirement. Likewise, keep each function concise and focused on a single responsibility where that boundary helps the system remain understandable and secure.

Concurrency planning should focus on simultaneous work, not just total request volume. A burst can create many concurrent operations even if the overall number of requests seems manageable. Consider the capacity of every dependency that receives those operations, and set limits or buffers where necessary.

A representative API architecture, not a universal stack

AWS’s sample web application pattern combines API Gateway and Lambda for business logic, DynamoDB for the database, Cognito for user management, and Amplify for static content. The whitepaper also discusses mobile backends and single-page application backends. Treat this as an example arrangement, not a mandatory stack: the right services depend on the application’s needs and constraints.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.