Im using codepipeline, codebuild and cloudformation on AWS.
My flow is:
Cloudformation (simplified):
CreateDoctorLambda:
Type: AWS::Lambda::Function
Properties:
Runtime: python3.6
Handler: lambda_function.lambda_handler
Role:
Fn::GetAtt:
- LambdaExecutionRole
- Arn
Code:
S3Bucket: !Ref LambdaFunctionS3Bucket
S3Key: CreateDoctor.zip
S3ObjectVersion: Latest <-- This value is invalid
Problem: When I update the code for lambda functions (this new code is zipped and uploaded to the S3 bucket during codebuild), the change is not deployed to the existing lambda functions.
According to AWS documentation:
To update a Lambda function whose source code is in an Amazon S3 bucket, you must trigger an update by updating the S3Bucket, S3Key, or S3ObjectVersion property. Updating the source code alone doesn't update the function.
Question: Is there any way to tell Cloudformation to use the latest version of the code stored in S3? Using S3ObjectVersion: Latest
will result in an error.
Its just an alternative workflow, but maybe it will solve your problem:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With