Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
YouTube Security VideosMicrosoft Mechanics: A Copilot Agent Writes the Status Report(23.09.2026 um 03:30 Uhr)
Sichere ProgrammierungOpenTelemetry in the GitHub Copilot app(23.09.2026 um 04:14 Uhr)
Sichere ProgrammierungMy Introduction:(23.09.2026 um 03:53 Uhr)
Sichere ProgrammierungAgentWallex: Content Day (Articles going live)(23.09.2026 um 04:00 Uhr)
Sichere ProgrammierungYour Low-Code Platform Is Fast Until a Customer Builds One Real Table(23.09.2026 um 04:11 Uhr)
YouTube Security VideosMicrosoft Mechanics: A Copilot Agent Writes the Status Report(23.09.2026 um 03:30 Uhr)
Sichere ProgrammierungOpenTelemetry in the GitHub Copilot app(23.09.2026 um 04:14 Uhr)
Sichere ProgrammierungMy Introduction:(23.09.2026 um 03:53 Uhr)
Sichere ProgrammierungAgentWallex: Content Day (Articles going live)(23.09.2026 um 04:00 Uhr)
Sichere ProgrammierungYour Low-Code Platform Is Fast Until a Customer Builds One Real Table(23.09.2026 um 04:11 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

EventBridge: working around API Destination 5s maximum client timeout constraint, using Lambda PowerTools idempotency

Amazon EventBridge API destinations are any HTTP endpoints that you can invoke as the target of an event bus rule, or pipe, similar to how you invoke an AWS service or resource as a target. I love them, because they provide built-in…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Amazon EventBridge API destinations are any HTTP endpoints that you can invoke as the target of an event bus rule, or pipe, similar to how you invoke an AWS service or resource as a target.



I love them, because they provide built-in retry (up to 185 times within 24h with exponential back off and jitter) and DLQ as well as input transform (making it possible to customise event format before it is pushed to the receiver), all for a ridiculously low pricing ($1/million event ingested + 0.20$/million event forwarded to an API destination). API destinations also come with managed authentication with the target.



I like to use them (see for instance here) to push events to 3rd party systems via Lambda, because going through an API Gateway makes it possible to invoke the Lambda synchronously, hence getting the above mentioned benefits.



Pushing an event using Lambda synchronous invocation via API Gateway



However, this feature comes with a major limitation: a 5s maximum client timeout!



AWS Documentation on EventBridge API Destination timeout



It's already quite hard to convince developers that their API should meet the 29sec timeout imposed by the API Gateway service (and though it is good practice, it is such a frequent - and painful -issue that AWS recently made it possible to raise the timeout to a higher value), but now trying to sell them a 5sec timeout limit is a hopeless case.



Most dev - and sometimes ops - reaction to a timeout



To be fair, quite often, we also need to push an event to third-party systems that we have no control over, and that do not provide a response time SLA.



A client of mine needed to call a system that would respond in less than 2sec most of the time... but over 10 seconds 3-4% of the time.






Overcoming EventBridge's timeout built-in limit!



The good thing is that even though EventBridge stops keeping interest, the invoked Lambda will continue doing its job until it reaches its own (maximum 15min) execution timeout. The bad thing is that EventBridge might perform a retry.



We definitely want reties in case of failure of previous attempts, but it could have bad consequences if our previous request is still processing (we might overload the destination API) or has finished (the processing may not be idempotent and handle replay well).



I started thinking about a way to store query status and response, in a DynamoDB table, and querying this store before triggering any new call. I even started to write some code and it started to become not trivial, or even quite complex, as we need to manage the possible statuses (not started, processing, finished successfully, failed with errors that can be retried (409, 429, and 5xx) or that can't be retried) and make sure (i) that there is no concurrent execution, and (ii) that EventBridge is aware of errors so it can adapt its own behaviour (retry or DLQ).



Then I figured that Lambda PowerTool could be of great help. Powertools for AWS Lambda is a developer toolkit to implement Serverless best practices and increase developer velocity. PowerTools comes with a great feature called Idempotency (available in Typescript, Python, Java or .NET) that does just what I needed.



Idempotency actually aims at addressing the fact that, due to the large-scale, distributed nature of EventBridge, some events can sometimes be delivered twice. Idempotency protects downstream workloads by




  • logging all calls in a DynamoDB table, with their status and response

  • blocking concurrent requests

  • caching responses so that we don't need to call again but can still use the response.






Implementing Powertools idempotency to meet our use case



PowerTools is very well documented and easy to use. In the following example,




  • I'm using the EventBridge event Id, encapsulated in the API Gateway event body, as the key to cache API call status and response.

  • I'm storing the idempotency data in a DynamoDB table









(If I needed to manage multiple destinations, I could use a composite key using the event ID and the API destination ID for instance)



To test this, I simply added a 180s sleep in my "business logic" section.




function delay(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}

await delay(180000);






When I push an event to Eventbridge, the first invocation of the Lambda creates a new elements in the DynamoDB table; at first, the event is "INPROGRESS" then after the sleep end, it moves to "COMPLETED"



Idempotency - DynamoDB table example



In the logs, I can see that EventBridge, faced with a client timeout, tried to retry the event processing multiples times. When the event status was INPROGRESS, the logs showed a IdempotencyAlreadyInProgressError.



Image description



When receiving such a response, EventBridge will just apply the retry policy and retry later on. Then, as the status is COMPLETED, the logs show that the Lambda returned the response to EventBridge, which then stopped sending the event ever again.



Image description






Conclusion



EventBridge's 5s timeout limitation may be a hard limit, but it is not that hard to work around this limitation.



Thanks to PowerTools for Lambda, it takes only a few lines of code! (and we can leave the heavy-lifting to unit-tested and battled-tested community code)



Idempotency, a Powertools for Lambda features, enable to work around the Eventbridge 5s maximum client timeout limitation






If you liked this post, please do not hesitate to comment here or connect on LinkedIn!

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten EventBridge: working around API Destination 5s maximum client timeout constraint, using Lambda PowerTools idempotency

Thematisch verwandte Begriffe: EventBridge, working, around, Destination · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-17636 | IBM Financial Transaction Manager (FTM) for RedHat OpenShift could allow…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick