CloudWatch Logs and SQS trigger serverless functions, decoupling database events from application logic.
Amazon Web Services has outlined an approach to using event-driven architecture in managing Amazon RDS for SQL Server to enable developers to create AWS Lambda functions based on the occurrence of events within the database via Amazon SQS and using CloudWatch Logs. This pattern provides a solution to one of the key issues in modern application design, by separating the mechanism used to identify events from the associated functionality that executes these events, allowing the database to manage data only, while employing specialized serverless solutions to engage in workflow management and integration.
A common implementation of a database trigger executes code within the database system itself and is thus highly coupled, limiting the ability to scale. By utilizing AWS's serverless computing technology, these types of bottlenecks can be avoided by separating the functionality of event detection and event execution into their own distinct services.
Implementing this pattern involves the use of SQL Server native functionality. Database administrators create stored procedures and publish specially formatted messages to the ERRORLOG using the RAISERROR statement. Amazon CloudWatch subscription filters capture these messages and call AWS Lambda functions that publish to an Amazon SNS topic. The SNS topic then sends the message to the appropriate Amazon SQS queues based on defined filter policies, which in turn will call the required destination Lambda function.
AWS published similar guidance for Aurora MySQL and MariaDB in 2024 with CloudWatch audit logs. Practitioners built upon this pattern with Kinesis Data Streams as an intermediary to facilitate batch processing and automatic retry handling between CloudWatch and Lambda. Common use cases include data pipelines, notifications of important database events, and real-time updates of search indexes and orchestration of microservices.
.webp)



























.webp)