Designing with Ports and Adapters
Explore the Ports and Adapters design pattern to create modular AWS Lambda functions. Understand how to separate business logic from infrastructure code for easier testing, better maintenance, and future scalability in serverless applications.
We'll cover the following...
Next, you’ll need to modify the ShowFormFunction Lambda function to validate the requested extension and return an error message in case of unsupported extensions. The function you wrote in the previous chapter was still relatively easy to read and understand. Putting more logic into that function definitely pushes it beyond the threshold of what could be considered simple.
A big part of making robust code is the ability to understand it easily and modify it with confidence. Both those goals are more attainable with some nice unit tests. However, your current function design is not really making that easy. The function directly talks to S3, requiring IAM privileges to execute, and it depends on several ...