serverless-lambda-version
v0.1.2
Published
Serverless plugin to auto update lambda function version for Lambda@Edge LambdaFunctionAssociations
Downloads
302
Maintainers
Readme
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
:exclamation: Any
LambdaFunctionARN
s already set toarn
+version
should be ignored by the plugin.
Cloudformation Output:
"LambdaFunctionAssociations": [
{
"EventType": "origin-request",
"LambdaFunctionARN": {
"Fn::Join": [
"",
[
{
"Fn::GetAtt": [
"MyfunctionLambdaFunction",
"Arn"
]
},
":",
{
"Fn::GetAtt": [
"MyfunctionLambdaFunctionOZWEIGtTFB4RTIGbHCEthNMa97ZkMRinlERrCc0",
"Version"
]
}
]
]
}
}
],