Is it possible to separate my code and infrastructure in serverless framework?
I'm using serverless framework (https://serverless.com) to deploy my AWS resources. I have a lambda functions defined in a serverless.yml file like this:
functions:
hello:
handler: handler.hello
...
Now I want to separate my infrastructure (serverless.yml) from my code. There would be two separated git projects: one for the infrastructure and one for the lambda (the code part).
This would be the development flow: Changes made in lambda project (git merge) would trigger a CI/CD pipeline to pull the code do the necessary checks (hint, test etc) and deploy the lambda to an s3 bucket.
After this I could include the s3 as a source of my lambda function and update the stack with the function that includes the changes. Something like this:
functions:
hello:
handler: function-s3-location
...
My questions:
1) Is it a good CI/CD approach?
2) Is it possible with serverless framework or it is possible only using AWS::Lambda::Functions code attribute to specify the s3 bucket?
Thank you!