Skip to content

Exploring an order handler architecture using FaaS, AWS, Serverless, DynamoDB, Lambda & SQS

License

Notifications You must be signed in to change notification settings

LucasPereiraMiranda/aws-lambda-order-handler

Repository files navigation


AWS Lambda Order Handler

GitHub language count Repository size GitHub last commit Repository issues GitHub license


🚀 Techs

AWS Lambda Order Handler was developed with these technologies:

💻 Project

This project is a serverless application with two functions, designed to publish and process orders efficiently under high load, as described above:

Architecture Preview

The developed functions are the following:

Functions Preview

  • publishOrders lambda function (API Gateway → SQS Producer):

    • Exposes an HTTP endpoint via API Gateway to accept new orders.
    • Validates incoming payloads to ensure data integrity.
    • Publishes the order message to an SQS queue, enabling asynchronous processing.
  • processOrders lambda function (SQS Consumer → DynamoDB Writer):

    • Listens to the SQS queue and processes incoming order messages.
    • Checks for idempotency before inserting orders into DynamoDB.
    • Handles potential failures and utilizes Dead Letter Queues (DLQs) to prevent message loss.

The SQS queue setup includes a dead letter queue for enhanced resilience, as described above:

Queues Preview

💻 Idempotency handler strategy

To prevent duplicate order processing, the system ensures idempotency by using unique order identifiers stored in DynamoDB. If an order with the same orderId already exists, it is ignored, ensuring that retries or duplicate events do not result in inconsistent data.

Idempotency Preview

💥 Installation

Follow these steps to set up the project with the Serverless Framework:

# Clone this repo
$ git clone git@github.com:LucasPereiraMiranda/aws-lambda-order-handler.git

# Navigate to the project directory
$ cd aws-lambda-order-handler

# Use Node 22 with .nvmrc reference
$ nvm use

# Install dependencies
$ npm install

# Install Serverless Framework globally
$ npm install -g serverless

# Deploy the serverless services to AWS after define your credentials with aws cli
$ serverless deploy

License

MIT

About

Exploring an order handler architecture using FaaS, AWS, Serverless, DynamoDB, Lambda & SQS

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published