0.1.2 • Published 8 years ago
serverless-lambda-version v0.1.2
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 LambdaFunctionARNs equal to the
logicalID string and the plugin will take care of the rest.
Install
$ npm install serverless-lambda-version --save-devAdd the plugin to your serverless.yml file:
plugins:
- serverless-lambda-versionUsage
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
LambdaFunctionARNs already set toarn+versionshould be ignored by the plugin.
Cloudformation Output:
"LambdaFunctionAssociations": [
{
"EventType": "origin-request",
"LambdaFunctionARN": {
"Fn::Join": [
"",
[
{
"Fn::GetAtt": [
"MyfunctionLambdaFunction",
"Arn"
]
},
":",
{
"Fn::GetAtt": [
"MyfunctionLambdaFunctionOZWEIGtTFB4RTIGbHCEthNMa97ZkMRinlERrCc0",
"Version"
]
}
]
]
}
}
],