2 Answers
- Newest
- Most votes
- Most comments
4
Hi,
Yes, you are right it is possible to achieve your desired outcome with the Run Command error -> EventBridge -> Lambda -> S3 configuration.
Lambda function triggered by Run Command errors:
-
Gets error details (instance ID, timestamp).
-
Checks if monthly CSV exists in S3 (May, 2024.csv).
Write CSV to S3: Use the S3 SDK to write the updated CSV data back to the S3 object with the appropriate filename (e.g., May, 2024.csv).
On Success:
Updates existing row (instance ID):
- Sets
lastsuccessto current date.
On Failure:
Updates existing row (instance ID):
-
- Increments
errorcount.
- Increments
New instance? Create new row:
- Add instance ID, current date as
lastsuccess, errorcount as 1.Always writes updated data back to monthly CSV in S3.
This keeps one CSV per month, updated daily with success dates and error counts.
Relevant content
- asked 2 years ago
