All Products
Search
Document Center

:Service-related commands

Last Updated:Apr 01, 2026

The FC component is a Serverless Devs-based CLI tool for Function Compute. Use it to call the Function Compute API directly from your terminal.

Prerequisites

Before you begin, ensure that you have:

Create a service

Synopsis

sudo s cli fc api CreateService
--region <region-id>
[--access <access-name>]
[--apiVersion <20210416|20160815>]
--body '{"serviceName": "<service-name>"
         [,"description": "<description>"]
         [,"internetAccess": true|false]
         [,"logConfig": "<log-config>"]
         [,"nasConfig": "<nas-config>"]
         [,"role": "<ram-role>"]
         [,"vpcConfig": "<vpc-config>"]
         [,"tracingConfig": "Enable"|"Disable"]}'

Parameters

ParameterRequiredDescription
--regionYesRegion where you want to deploy the service
--access / -aNoAlias of the key to use
--apiVersionNoAPI version. Valid values: 20210416, 20160815
serviceName (body)YesService name
description (body)NoService description
internetAccess (body)NoSpecifies whether the function can access the internet. Valid values: true, false
logConfig (body)NoLog configuration. Specifies the Logstore to store function logs
nasConfig (body)NoFile Storage NAS (NAS) configuration. Specifies the NAS file system for the function to access
role (body)NoResource Access Management (RAM) role
vpcConfig (body)NoVirtual Private Cloud (VPC) configuration. Specifies the VPC the function can access
tracingConfig (body)NoSpecifies whether to enable Managed Service for OpenTelemetry. Valid values: Enable, Disable

Example

sudo s cli fc api CreateService --region cn-hangzhou --access default --body '{"description": "mytest","serviceName": "mytest"}'

For the full API reference, see CreateService.

Delete a service

Synopsis

sudo s cli fc api DeleteService
--region <region-id>
[--access <access-name>]
[--apiVersion <20210416|20160815>]
--path '{"serviceName": "<service-name>"}'
[--header '{"If-Match": "<etag>"}']

Parameters

ParameterRequiredDescription
--regionYesRegion where the service is deployed
--access / -aNoAlias of the key to use
--apiVersionNoAPI version. Valid values: 20210416, 20160815
serviceName (path)YesService name
If-Match (header)NoEnsures that the changed resource is the resource that you want to change

Example

sudo s cli fc api DeleteService --region cn-hangzhou --access default --path '{"serviceName": "mytest"}'

For the full API reference, see DeleteService.

Update a service

Synopsis

sudo s cli fc api UpdateService
--region <region-id>
[--access <access-name>]
[--apiVersion <20210416|20160815>]
--path '{"serviceName": "<service-name>"}'
[--body '{"description": "<description>"
          [,"internetAccess": true|false]
          [,"role": "<ram-role>"]
          [,"logConfig": "<log-config>"]
          [,"nasConfig": "<nas-config>"]
          [,"vpcConfig": "<vpc-config>"]
          [,"tracingConfig": "Enable"|"Disable"]}']
[--header '{"If-Match": "<etag>"}']

Parameters

ParameterRequiredDescription
--regionYesRegion where the service is deployed
--access / -aNoAlias of the key to use
--apiVersionNoAPI version. Valid values: 20210416, 20160815
serviceName (path)YesService name
description (body)NoService description
internetAccess (body)NoSpecifies whether the function can access the internet. Valid values: true, false
role (body)NoRAM role
logConfig (body)NoLog configuration. Specifies the Logstore to store function logs
nasConfig (body)NoFile Storage NAS (NAS) configuration. Specifies the NAS file system for the function to access
vpcConfig (body)NoVPC configuration. Specifies the VPC the function can access
tracingConfig (body)NoSpecifies whether to enable Managed Service for OpenTelemetry. Valid values: Enable, Disable
If-Match (header)NoEnsures that the changed resource is the resource that you want to change

Example

sudo s cli fc api UpdateService --region cn-hangzhou --access default --path '{"serviceName": "mytest"}' --body '{"internetAccess": false}'

For the full API reference, see UpdateService.

Get service configurations

Synopsis

sudo s cli fc api GetService
--region <region-id>
[--access <access-name>]
[--apiVersion <20210416|20160815>]
--path '{"serviceName": "<service-name>"
         [,"qualifier": "<version-or-alias>"]}'

Parameters

ParameterRequiredDescription
--regionYesRegion where the service is deployed
--access / -aNoAlias of the key to use
--apiVersionNoAPI version. Valid values: 20210416, 20160815
serviceName (path)YesService name
qualifier (path)NoService version or alias

Example

sudo s cli fc api GetService --region cn-hangzhou --access default --path '{"serviceName": "mytest","qualifier": "LATEST"}'

For the full API reference, see GetService.

List services

ListServices is a paginated operation. Use limit to control the page size and nextToken to retrieve subsequent pages. Omit nextToken on the first call; include the token returned in each response to get the next page.

Synopsis

sudo s cli fc api ListServices
--region <region-id>
[--access <access-name>]
[--apiVersion <20210416|20160815>]
[--query '{"limit": "<count>"
           [,"nextToken": "<token>"]
           [,"prefix": "<name-prefix>"]
           [,"startKey": "<start-key>"]}']

Parameters

ParameterRequiredDescription
--regionYesRegion to query
--access / -aNoAlias of the key to use
--apiVersionNoAPI version. Valid values: 20210416, 20160815
limit (query)NoMaximum number of services to return per page
nextToken (query)NoPagination token from the previous response. Omit on the first call
prefix (query)NoFilters results to services whose names start with this prefix
startKey (query)NoReturns services alphabetically starting from (and including) this key

Example

sudo s cli fc api ListServices --region cn-hangzhou --access default --query '{"limit": "10","prefix": "my"}'

For the full API reference, see ListServices.