I am storing lambda layer code in s3 in zip file. This file is updated each time I am making changes in the code. First deployment succseed, but now when I am trying to update it I am getting message that there are not changes to deploy. I checked file in s3, it is containing changes.
cloudformation template:
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Resources:
CommonLayer:
Type: AWS::Lambda::LayerVersion
UpdateReplacePolicy: Retain
Properties:
LayerName: "common-lib"
Description: ""
Content:
S3Bucket: artifacts-8473625
S3Key: layer.zip
CompatibleRuntimes:
- python3.9
I was able to fix it by adding parameter to layer description which is updated with each deployment.
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Parameters:
LatestLambdaLayerVersion:
Type: String
Default: v1
Description: lambda layer latest version
Resources:
CommonLayer:
Type: AWS::Lambda::LayerVersion
UpdateReplacePolicy: Retain
Properties:
LayerName: "common-lib"
Description: !Sub "Common layer ${LatestLambdaLayerVersion}"
Content:
S3Bucket: artifacts-8473625
S3Key: layer.zip
CompatibleRuntimes:
- python3.9