I'm exercising an idea of not using S3 bucket to refer to the code of a lambda function.
The usual example of a lambda CloudFormation code might look like:
MyLambda:
Type: AWS::Lambda::Function
Properties:
FunctionName: hello
Handler: index.handler
Runtime: nodejs8.10
Role: !GetAtt LambdaExecutionRole.Arn
Code:
ZipFile: |
<can we "inject" the code and/or binary here?>
But what I would like to do instead is:
- inject that code from the file system, after potentially running my (unit) tests against that code;
- maybe even just inject a compiled binary instead of actual code;
It is possible to do similar using CLI (create a zip manually, refer to it). I understand that CloudFormation changes would be running on the AWS infrastructure and not locally or a build server, so I'm open to other non-CloudFormation options.
So my question is - what is the best way to deploy the AWS functions sticking to "infrastructure as code", preferably sticking with CloudFormation. Or is S3 + CloudFormation really the best option?