Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Serverless: how to remove one function

I am using serverless to deploy my API on AWS.

In serverless, it allows to deploy a single function:

sls deploy -f <function name>

But it doesn't allow to remove a single function:

sls remove // will remove all functions.

Is there any way to remove single function which won't impact to other functions?

like image 943
Phong Vu Avatar asked Jun 15 '18 13:06

Phong Vu


People also ask

What does SLS remove do?

The sls remove command will remove the deployed service, defined in your current working directory, from the provider. It will remove the Fn Function functions from your Fn server.

Which command is used to call the function in serverless framework SLS invoke?

Invokes a deployed function. You can send event data, read logs and display other important information of the function invocation.

What is service in serverless yml?

Service. service: app. The service is simply the name of your project. Since Serverless lets us deploy a project in multiple stages (prod, dev, staging…), CloudFormation stacks will contain both the service name and the stage: app-prod , app-dev , etc.


1 Answers

@justin.m.chase suggested:

Simply remove the function in serverless.yml, then run full deploy

sls deploy

the function is removed (Lambda + API Gateway). Perfecto!

like image 85
Phong Vu Avatar answered Oct 02 '22 14:10

Phong Vu