SAM gives you a fair bit over CloudFormation, here’s just a few that people use regularly:
sam local invoke
lets you invoke function locally to get quick feedback before deploying, also, you can attach a debugger if you need to step through the code.sam local start-api
lets you run a local version of API Gateway with your code, useful when you’re doing server-side rendering.- Makes configuring API Gateway resources bearable. I know you can have more control with CF, but damn, it’s hard work!
- Setting default permissions for the relevant event sources (especially the ones that push to your function).
- Enforcing naming convention so you can actually find things easily.
- Packaging the deployment package(s).
- Embedding Serverless repository apps.
- Declaring globals so you don’t have to declare the same configurations over and over.
Many of the deployment frameworks offer these capabilities, I did a comparison of them a while back.
Instead of why use SAM for simple apps when CF gives you more control? I’d be interested to understand why I need the additional control for simple apps, especially if I have to give up all the support SAM and other frameworks give me. If there’s a tool that works for simple apps and can keep things manageable when that simple app grows (don’t they always?), why not use it?