Ravi Sir's Cards › AWS
Why an async order API?
This revision card explains Why an async order API? If checkout waits for inventory, fraud checks, and email, the shopper stares at a spinner and retries. It describes async intake — API accepts the order fast (HTTP 202), puts a message on SQS, and a worker Lambda writes DynamoDB later. The how-to section notes build SQS queue + DynamoDB PK orderId + intake Lambda (SendMessage) + worker Lambda (SQS trigger) + POST /orders.
Read card text
What this card says
Why do we need it?
If checkout waits for inventory, fraud checks, and email, the shopper stares at a spinner and retries.
What is it?
Async intake: API accepts the order fast (HTTP 202), puts a message on SQS, and a worker Lambda writes DynamoDB later.
How to do it
Build SQS queue + DynamoDB PK orderId + intake Lambda (SendMessage) + worker Lambda (SQS trigger) + POST /orders.
202 Accepted
Example
curl POST {"sku":"TEE-RED","qty":2} returns 202 in ~50 ms; ~2 s later DynamoDB shows status accepted.