Updated on 2025-12-10 GMT+08:00

remove

remove Commands

remove commands are used to remove a deployed resource. Resources cannot be recovered once removed.

Command Parsing

You can run remove -h or remove --help to view the documentation.

This command includes four subcommands:

Table 1 Parameter description

Parameter Name

Abbreviation

Required in YAML

Description

assume-yes

y

No

During interaction, y is selected by default.

Example

If a resource description file (YAML) is available, run the s remove command to delete the resource. The following is an example of the resource description file (YAML):
Function [myFunction] deleted successfully.

remove function

remove function is used to delete a specified function. This will also delete all versions, aliases, and triggers of the function.

You can run remove function -h or remove function --help to view the documentation.

Table 2 Parameter description

Parameter Name

Abbreviation

Required in YAML

Required in CLI

Description

region

-

No

Yes

Region

function-name

-

No

Yes

Function name

assume-yes

y

No

Yes

During interaction, y is selected by default.

Example

  • If you have a resource description file (YAML), run s remove function to delete a specified function.
  • If you use CLI (without a YAML resource description file), specify the name and region of the service. For example, s cli fgs remove function --region cn-north-4 --function-name fgs-test.

    When using CLI, if the key is not default, add the access parameter. For example, s cli fgs remove function --region cn-north-4 --function-name fgs-test --access xxxx.

    Execution result of the preceding command:
    Function [fg-test] deleted.

remove trigger

remove trigger is used to delete a specified trigger.

You can run remove trigger -h or remove trigger --help to view the documentation.

This command also supports some global parameters, such as -a/--access and --debug. For details, see Global Parameters of Serverless Devs.

Table 3 Parameter description

Parameter Name

Abbreviation

Required in YAML

Required in CLI

Description

region

-

No

Yes

Region

function-name

-

No

Yes

Function name

version-name

-

No

No

Version. Default: latest

trigger-type

-

No

Yes

Trigger type

trigger-name

-

No

Yes

Trigger name. APIG: API name; OBS: bucket name; TIMER: trigger name

assume-yes

y

No

No

During interaction, y is selected by default.

Example

  • If you have a resource description file (YAML), run s remove trigger to delete a trigger declared in the file.
  • If you use CLI (without a YAML resource description file), specify the name and region of the service. For example, s cli fgs remove trigger --region cn-north-4 --function-name fgs-test --trigger-type APIG --trigger-name fgs-test-trigger.
Execution result of the preceding command:
Trigger [fgs-test-trigger] deleted.

remove version

remove version is used to delete a specified version.

You can run remove version -h or remove version --help to view the documentation.

This command also supports some global parameters, such as -a/--access and --debug. For details, see Global Parameters of Serverless Devs.

Table 4 Parameter description

Parameter Name

Abbreviation

Required in YAML

Required in CLI

Description

region

-

No

Yes

Region

function-name

-

No

Yes

Service name

version-name

-

Yes

Yes

Version name, which cannot be latest.

Example

  • If you have a resource description file (YAML), run s remove version --version-name versionName to delete a specified versionName.
  • If you use CLI (without a YAML resource description file), specify the region and name of the service. For example, s cli fgs remove version --region cn-north-4 --function-name fgs-test --version-name v1.
Execution result of the preceding command:
Version [v1] deleted.

remove alias

remove alias is used to delete a specified alias.

You can run remove alias -h or remove alias --help to view the documentation.

This command also supports some global parameters, such as -a/--access and --debug. For details, see Global Parameters of Serverless Devs.

Table 5 Parameter description

Parameter Name

Abbreviation

Required in YAML

Required in CLI

Description

region

-

No

Yes

Region

function-name

-

No

Yes

Service name

alias-name

-

Yes

Yes

Alias

Example

  • If you have a resource description file (YAML), run s remove alias --alias-name aliasName to delete a specified alias.
  • If you use CLI (without a YAML resource description file), specify the region and name of the service. For example, s cli fgs remove alias --region cn-north-4 --function-name fgs-test --alias-name pre.
Execution result of the preceding command:
Alias [pre] deleted.