mjendza / aws-sandbox

This is my AWS Serverless stack. Build with CDK, NodeJS Lambda, DynamoDB storage.
Apache License 2.0
6 stars 1 forks source link

Do not go this way! #39

Closed mjendza closed 2 years ago

mjendza commented 2 years ago

the execution drama!

image

post mortem

what happend

 eventPattern: {
            source: [{ prefix: '' }],
        },

with the bug in the code - we were generating the UserCreated event in the code instead of use the Outbox Pattern with DynamoDB with lambda lambda-created-user-event-publisher and

record.eventName == 'INSERT'

with works perfectly. There is only one event in the system. So, with these two bugs - we made a circuit execution - so generating UserCreated and processing as CreateUser we generated a lot of events:

image

when noticed

how noticed

Lumigo dashboard and email alerts

how stopped

removed stack ;) can disable the rule

cost

image

service cost details details
CloudWatch $2.98 4.084 GB PutLogEvents
CloudWatch Events $0.56 559,812.000 64K-Chunks
DynamoDB $4.47 2,796,906.000 WriteRequestUnits
Lambda $0.34 1,696,943.000 Request
X-RAY $2.40 384,865.000 traces STORED + 484,865.000 InsightsTracesStored

how to prevent this situation in the future

mjendza commented 2 years ago

By one event via API Gateway image

mjendza commented 2 years ago

this can be the bug image

mjendza commented 2 years ago

image