Valerie Tremblay
Less Glue Code With Eventbridge Pipes
Pull requests that have more lines removed than added are my favorites! That's why I'm excited about EventBridge Pipes!
This article is part of a series aimed at demonstrating how to minimize the creation and maintenance of non-value-added code using various AWS capabilities. For the introduction, see The Cloud to Reduce Non-Value-Added Code.
To experiment with EventBridge Pipes, I identified a Lambda integration that could be replaced.
This Lambda function receives events from DynamoDB Stream, performs transformation and filtering, and then publishes them to an EventBridge bus. For 1 million invocations of the Lambda, the cost is: $1.24/month (for 500 ms, 128 Mb, see Lambda Cost Calculator
EventBridge Pipe allows for getting rid of the Lambda function. For 1 million requests entering the Pipe, the cost is $0.44/month. The fees can be further limited by controlling at the source the events entering the Pipe. For example, by keeping only insertion requests and ignoring updates or deletions.
By replacing this Lambda integration with EventBridge Pipes, a net total of 18 lines of code is currently being eliminated. This does not include the package.json and package-lock.json files, whose removal is represented in the cover image.
In these examples, the infrastructure code is written in YAML, using SAM (Serverless Application Model). For Serverless applications, SAM allows for reducing infrastructure code writing compared to CloudFormation.
In the Lambda version, SAM supports the creation of the necessary execution role. However, this is not available for EventBridge Pipes. That's why we see +30 lines of configuration appearing. Regarding this, an EventBridge developer writes on Twitter that the team is working on supporting
Pipes in Sam in 2023.
Conclusion
EventBridge Pipes support several other sources and destinations. Its use avoids writing glue code. This addition to AWS's Serverless offerings is another way to allow developers to focus on added value, that is, business logic, and delegate the maintenance of non-value-added code to the cloud provider.