Skip to main content

How do event delivery and idempotency work in serverless systems?

Design safe event consumers around at-least-once delivery, duplicate messages, ordering boundaries, deduplication records, and transactional side effects.

How do event delivery and idempotency work in serverless systems?

Serverless event integrations commonly provide at-least-once delivery, which means a valid event can reach a consumer more than once when processing or acknowledgment is uncertain. Idempotency is the property that processing the same logical operation repeatedly produces the same intended outcome as processing it once.

How this topic fits

Reliability

Plan for duplicate delivery, partial failure, retries, dead letters, quotas, backpressure, recovery, and regional dependencies.

Treat duplicate delivery as normal recovery

A consumer can complete its side effect and fail before the source records success. The source cannot safely assume completion, so it delivers the message again. Networks, timeouts, batch retries, producer retries, and failover create similar ambiguity.

Exactly-once language often describes a bounded service feature, not an end-to-end business guarantee. Verify the complete path from producer through every side effect before relying on it.

Choose a stable idempotency key

Use an identifier for the logical business operation, not a delivery attempt. A payment request, order command, file version, or source event identifier can work when its uniqueness scope and retention are defined.

Store the key with status, result, and expiration in a strongly consistent operation when possible. Two concurrent duplicate attempts must not both pass a check-then-write race.

Make every side effect safe

Database writes can use conditional operations or transactions. External APIs may support their own idempotency key. If an irreversible dependency has no such control, isolate it behind a record of intent and a recovery process.

Returning an earlier successful result can make synchronous retries transparent. For asynchronous work, record enough outcome information to distinguish completed, in-progress, retryable, and permanently failed operations.

Separate deduplication from ordering

Removing duplicates does not ensure events are processed in order, and ordering does not prevent duplicate attempts. Define the entity or message group that needs order and how late or stale events are recognized.

Use version numbers, sequence values, conditional writes, or state-machine rules when an older event must not overwrite newer state. Test concurrent delivery and replay, not only consecutive duplicates.

Go deeper with AWS

Read the primary AWS documentation behind the service definitions and architecture guidance in this guide.

Explore serverless products

Questions about this topic

Browse all serverless concepts

Explore compute, APIs, events, workflows, data, security, reliability, operations, delivery, and AI from one connected AWS serverless learning path.

What is serverless?

Learn what serverless computing means, how it works on AWS, what the cloud provider manages, and which trade-offs still belong to your team.

Read the guide

What is AWS Lambda?

Understand how AWS Lambda runs code, how functions are invoked, where permissions and state live, and when Lambda is a good compute choice.

Read the guide

What is serverless architecture?

Learn how managed compute, APIs, events, queues, workflows, data, identity, and observability fit together in a serverless architecture on AWS.

Read the guide

AWS serverless security

A practical guide to identity, least privilege, event validation, secrets, data protection, dependencies, and incident visibility in AWS serverless systems.

Read the guide

What is agentic AI?

Learn what makes an AI system agentic, how models, tools, memory, orchestration, identity, and evaluation fit together, and where serverless patterns help on AWS.

Read the guide

What is cloud computing?

Understand how on-demand infrastructure and managed services change the way teams provision, scale, pay for, and operate software systems.

Read the guide

What is event-driven architecture?

Learn how producers, routers, and consumers communicate through events, and how to design schemas, delivery, retries, and ownership deliberately.

Read the guide

What is a serverless API?

Understand the request path, authentication, routing, compute, data, throttling, observability, and failure controls behind a serverless API on AWS.

Read the guide

What are serverless workflows?

Learn when explicit workflow state improves retries, branching, parallel work, human approval, visibility, and recovery in distributed applications.

Read the guide

What is Amazon API Gateway?

Learn how API Gateway creates, publishes, secures, monitors, and operates HTTP, REST, and WebSocket APIs for AWS and external backends.

Read the guide

What is Amazon EventBridge?

Understand EventBridge event buses, rules, pipes, schemas, targets, schedules, permissions, delivery, and recovery in event-driven AWS systems.

Read the guide

Make the next serverless decision explicit.

Explore focused products for repeatable work, or bring the architecture decision that needs context and experienced review.