'Avoid re-build of AWS Lambda Layer in CDK
I have a CDK stack that, among other infrastructure elements, deploys an AWS Lambda Layer (or actually a lambda.LayerVersion
). I noticed that every time I update the stack a new version of the Layer is built, although its contents do not change. This leads to a whole bunch of layers that are inherently the same. Is there an easy way to avoid this behaviour and only create a new layer version when the contents actually change?
const testLambdaLayer = new lambda.LayerVersion(this, 'TestLambdaLayer', {
code: lambda.Code.fromAsset('../test/lambda/layer/'),
compatibleRuntimes: [lambda.Runtime.PYTHON_3_8],
layerVersionName: 'requests-layer',
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|