I need to build a CI/CD pipeline that updates the code of an existing Lambda Function that was created using the console. Creating a new one is not an option!
I was successful deploying the code using CloudFormation in the Deploy Stage but, it can only update the code for Lambda functions that are created with CloudFormation/SAM. When I specify the name of and existing Lambda in the template.yaml file it tries to create it and tells me that it already exists!
The 2nd way i tried is deploying using CodeDeploy and i get this error: - "BundleType must be either YAML or JSON"
This thread gives a workaround this problem and i could not apply it to my case: CodePipeline: CodeDeploy reports "BundleType must be either YAML or JSON"
Is there any other way to make a proper CI/CD pipeline that only updates the code for a Lambda Function ?
One way of updating Lambda code from CloudFormation would be to store your Lambda code in S3 with versioning enabled.
Here: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html
So, the pipeline could be something like:
Hope that helps.