Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to apply Serverless to an existing Lambda

When I try deploy to an existing lambda function configured in serverless.yml as following, it says "An error occurred: ApiLambdaFunction - an-existing-function-name-created-by-my-devops already exists."

functions:
  api:
    name: an-existing-function-name-created-by-my-devops

So it is not allowed to deploy to an existing lambda not created by serverless?

like image 619
James Sun Avatar asked Jun 17 '20 19:06

James Sun


1 Answers

As Serverless manages your resources via a CloudFormation Stack, you could probably be able to import the lambda function within the UI (Import Existing Resources into a CloudFormation Stack) and do the deploy afterwards again.

I did not try this and there's most probably a better solution though.

Edit: precondition is that you successfully created your stack before adding your desired function.

like image 117
tpschmidt Avatar answered Oct 18 '22 22:10

tpschmidt