I am not sure which is best/good practice as well. Seems your research made the right conclusion.
The owner of the link you provided talks about Serverless Design Patterns and Best Practices.
but only focus solution with Cloudformation template only.
If you or your team have strong knowledges about Cloudformation template, it is not bad idea to manage ALL codes in serverless.yml
It will depend on the skillsets in your team.
I personally have very well knowledges and several year project experiences with Hashicorp Terraform, so in my serverless projects, I only manage serverless related resource with serverless framework, and let Terraform to take care of whole infrastructure as code.
The reason is, Cloudformation yaml is too hard to write and will spend much time to maintain in the future. I always try to avoid writting CFN. With current features in serverless framework, a lot of infrastrure resource codes are missed, so in most time, if the resource is not api gateway, lambda, dynamodb, I just copy the cloudformation yaml codes directly into serverless.yml
. There are serverless plugins which can do extra jobs easily, such as manage domain name, but I will only add these plugins if it need spend too much time with CFN.
For layer management, of course, you need several stacks. VPC, databases/redis/memcache/Elastic/etc, and application layers.
For application layers, you can manage one serverless.yml (or several serverless.yml
) with different custom
option for different stages (such as dev/uat/prod). I discuss this with another ticket before: Manage variables for deploying a serverless project with different environments ,take a look.
If you need reference another sls stack outputs, please read this: https://serverless.com/framework/docs/providers/aws/guide/variables/#reference-cloudformation-outputs