Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update Existing Lambda Function Using AWS Continuous Integration/Deployment

I have several AWS Lambda Functions created using AWS Console and every function has some dependent APIs.Now I want to integrate the same with AWS CI/CD using CodeBuild, CodePipeline, and CloudFormation. But the problem is I'm unable to update the existing lambda functions that are not created using the CloudFormation Stack
Error Message ABC_Lambda already exists

Please note that if I create a new lambda using the CI/CD flow and then try to update it, that's working fine.

So my questions are

  1. How do I integrate the existing Lambda functions with AWS CI/CD workflow, without deleting and re-creating them?

  2. Is there any way or SAM_template config param that force the CloudFormation to update the existing lambda(created using AWS console/AWS Commandline tool).

like image 560
Akay Nirala Avatar asked Oct 16 '22 06:10

Akay Nirala


1 Answers

As noted by @omuthu, if you have not created the Lambdas with Cloudformation, you cannot use Cloudformation to update them.

What you could do, is, in your CodeBuild step, use the update-function-code and update-function-configuration APIs to perform the operations you need. This though does not allow you to integrate with SAM due to the limitation mentioned above.

like image 87
Milan Cermak Avatar answered Oct 20 '22 15:10

Milan Cermak