DEV Community

Cover image for Synchronous & Event Driven
Ravisankar.ponugoti
Ravisankar.ponugoti

Posted on Fully Autonomous

Synchronous & Event Driven

Synchronous Architecture

caller -----> api Gateway ------> lambda ------> DynamoDB

caller call the api -> api calls this lambda ----> that lambda goes to a database DynamoDB

in this case , the caller invoke this api and wait for response during the same invocation
this type of architecture is called synchronous architecture.

example:-
Synchronous flow

Caller
|
| 1. HTTP request
↓
API Gateway
|
| 2. Synchronously invokes
↓
Lambda
|
| 3. Reads/Writes
↓
DynamoDB
|
| 4. Response
↑
Lambda
↑
API Gateway
↑
Caller

What happens step by step?

Suppose the caller sends:

GET /user/123
Enter fullscreen mode Exit fullscreen mode
  1. Caller → API Gateway**

The caller says:

"Give me the details of user 123."

  1. API Gateway → Lambda**

API Gateway invokes Lambda synchronously.

Meaning:

"Lambda, execute this function and give me the result."

  1. Lambda → DynamoDB**

Lambda asks DynamoDB:

"Give me user 123."

  1. DynamoDB → Lambda**

DynamoDB returns the data.

  1. Lambda → API Gateway → Caller**

Lambda returns the result, and API Gateway sends it back to the caller.
The important part

Yes, the caller waits for the HTTP response.

So your statement can be improved to:

"In a synchronous architecture, the caller sends a request to API Gateway and waits for the response. API Gateway synchronously invokes Lambda. Lambda processes the request, accesses DynamoDB, and returns the result through API Gateway to the caller as part of the same request-response flow."

Top comments (0)