I’m new to serverless and I have some questions regarding lambda deployments.
We have existing lambda functions that were created manually and now we want to deploy them using serverless.
If I run: “serverless deploy --stage dev --region us-east-1”
I get an error: “An error occurred: RetrieveLogGroup - /aws/lambda/xxx-dev already exists”
Our apps are invoking this lambda by name so I cannot delete it before deploying using serverless.
Is there a way for me to deploy without deleting the functions and just “replace” them or something similar?
Hi Lior. Answered you in Gitter. For anyone else coming later and finding this via Google, this is the answer I gave:
Each deployment uses CloudFormation as a way to keep current deployment state. This isnt something I have done so YMMV, but you could try using the CloudFormation resource import feature. In other words, deploy your new Serverless service without the existing functions just to get the initial deployment done, import the existing functions into the CloudFormation stack created by the deployment, add the existing functions to the serverless.yml and now when you deploy it should all sync up.
Thanks for the quick reply, I will try this and update on the results
I can’t seem to make it work.
However I export the Lambda function, when I try to import it to the CloudFormation stack created by serverless framework I get an error.