serverless-lambda-version
A Serverless v1.x plugin to auto update lambda function version for Lambda@Edge LambdaFunctionAssociations.
Amazon recently added a requirement to LambdaFunctionAssociations, where you can
no longer reference the arn
+alias
(or $LATEST
) and are now required to
provide arn
+version
. This plugin handles appending on the version for you.
You just need to set your LambdaFunctionARN
s equal to the
logicalID string and the plugin will take care of the rest.
Install
$ npm install serverless-lambda-version --save-dev
Add the plugin to your serverless.yml
file:
plugins: - serverless-lambda-version
Usage
Set your yml references LambdaFunctionAssociations[n].LambdaFunctionARN
equal
to the logicalID of your function.
functions: myfunction: handler: functions/myfunction/handler.myfunctionHandler resources: Resources: CDN: Type: "AWS::CloudFront::Distribution" Properties: DistributionConfig: ... DefaultCacheBehavior: ... LambdaFunctionAssociations: - EventType: origin-request LambdaFunctionARN: MyfunctionLambdaFunction
❗️ Any
LambdaFunctionARN
s already set toarn
+version
should be ignored by the plugin.
Cloudformation Output:
"LambdaFunctionAssociations": ,