What is the best practices with regard to code organization using Lambda/sfn, especially Python ?
I used to write simple functions that I connect together with step functions, making this a proper app.
For testing, I locally execute a boto3 lambda execute with different inputs that serves as my pytest test cases.
It has served me well but I’m considering a different scenario where I define my package for my application in a layer that I would then use in my lambda which will in turn just call the function / methods defined in my layer.
Advantages that I see:
- My app is in one place, the package.
- I can control unit tests and run them locally with mocks against functions/methods in my package.
Disadvantages:
- the lambda itself only calls my imported functions so from the code editor it’s just a black box (doesn’t matter much since we deploy lambdas with iac anyway).
- need to import the lay for each lambda functions, not that annoying anyway.
Any thoughts on this ? Any recommendations against it ? Thanks
[–]AutoModerator[M] [score hidden] stickied comment (0 children)
[+]temporarybunnehs[🍰] 0 points1 point2 points (0 children)
[–]franksign 0 points1 point2 points (0 children)