title | description | position | category |
---|---|---|---|
Ondemand commands |
Ondemand commands |
4 |
Release&configuration |
You can use the ondemand
command to manage on-demand resources of Function Compute.
- Command description
- ondemand get command
- ondemand list command
- ondemand put command
- remove ondemand command
- Permissions and policies
You can run the ondemand -
h or ondemand --help
command to query the help information.
The ondemand command consists of three subcommands:
- get: Queries the details of on-demand resources.
- list: Queries the lists of on-demand resources.
- put: Publishes or updates configurations of on-demand resources.
The ondemand get
command is used to query the details of specified on-demand resources.
You can run the ondemand get -h
or ondemand get --help
command to query the help information.
Full name | Abbreviation | Required in YAML mode | Required in CLI mode | Description |
---|---|---|---|---|
region | - | No | Yes | The region. Valid values: cn-hangzhou, cn-beijing, cn-beijing, cn-hangzhou, cn-shanghai, cn-qingdao, cn-zhangjiakou, cn-huhehaote, cn-shenzhen, cn-chengdu, cn-hongkong, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-5, ap-northeast-1, eu-central-1, eu-west-1, us-west-1, us-east-1, and ap-south-1. |
service-name | - | No | Yes | The name of the service. |
function-name | - | No | Yes | The name of the function. |
qualifier | - | Yes | Yes | The version. You can specify LATEST or an alias. |
The current command also supports some global parameters (such as
-a/--access
,--debug
, etc.). For details, please refer to Serverless Devs global parameters document
-
If a YAML resource description file exists, you can run the
s ondemand get --qualifier qualifier
command to obtain the details of on-demand resources based on a specified version. -
If no YAML file exists and you use the command-line interface (CLI) mode, you must specify the region and name of the service. Example:
s cli fc ondemand get --region cn-hangzhou --service-name fc-deploy-service --qualifier qualifier
;
Sample output:
fc-deploy-test:
serviceName: fc-deploy-service
functionName: http-trigger-py36
qualifier: LATEST
resource: services/fc-deploy-service.http-trigger-py36/functions/LATEST
maximumInstanceCount: 1
The ondemand list
command is used to query the lists of on-demand resources.
You can run the ondemand list -h
or ondemand list --help
command to query the help information
Full name | Abbreviation | Required in YAML mode | Required in CLI mode | Description |
---|---|---|---|---|
region | - | No | Yes | The region. Valid values: cn-hangzhou, cn-beijing, cn-beijing, cn-hangzhou, cn-shanghai, cn-qingdao, cn-zhangjiakou, cn-huhehaote, cn-shenzhen, cn-chengdu, cn-hongkong, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-5, ap-northeast-1, eu-central-1, eu-west-1, us-west-1, us-east-1, and ap-south-1 . |
service-name | - | No | Yes | The name of the service. |
table | - | No | No | Exports the query results in a table. |
The current command also supports some global parameters (such as
-a/--access
,--debug
, etc.). For details, please refer to Serverless Devs global parameters document
- If a YAML resource description file exists, you can run the
s ondemand list
command to query the lists of on-demand resources. - If no YAML file exists and you use the CLI mode, you must specify the region and name of the service. Example:
s cli fc ondemand list --region cn-hangzhou --service-name fc-deploy-service
Sample output:
fc-deploy-test:
-
serviceName: fc-deploy-service
qualifier: http-trigger-py36
functionName: LATEST
resource: services/fc-deploy-service.http-trigger-py36/functions/LATEST
maximumInstanceCount: 1
Sample output if you specify the --table
parameter:
┌───────────────────┬───────────────────┬──────────────┬──────────────────────┐
│ serviceName │ qualifier │ functionName │ maximumInstanceCount │
├───────────────────┼───────────────────┼──────────────┼──────────────────────┤
│ fc-deploy-service │ http-trigger-py36 │ LATEST │ 1 │
└───────────────────┴───────────────────┴──────────────┴──────────────────────┘
The ondemand put
command is used to publish or update an alias.
You can run the ondemand put -h
or ondemand put --help
command to query the help information.
Full name | Abbreviation | Required in YAML mode | Required in CLI mode | Description |
---|---|---|---|---|
region | - | No | Yes | The region. Valid values: cn-hangzhou, cn-beijing, cn-beijing, cn-hangzhou, cn-shanghai, cn-qingdao, cn-zhangjiakou, cn-huhehaote, cn-shenzhen, cn-chengdu, cn-hongkong, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-5, ap-northeast-1, eu-central-1, eu-west-1, us-west-1, us-east-1, and ap-south-1 . |
service-name | - | No | Yes | The name of the service. |
function-name | - | No | No | The name of the function. |
qualifier | - | Yes | Yes | The version. You can specify LATEST or an alias. |
max | - | Yes | Yes | The maximum number of instances. |
The current command also supports some global parameters (such as
-a/--access
,--debug
, etc.). For details, please refer to Serverless Devs global parameters document
- If a YAML resource description file exists, you can run the
s ondemand put --qualifier qualifier
command to configure on-demand resources. - If no YAML file exists and you use the CLI mode, you must specify the service name, the service region, and the function name. Example:
s cli fc ondemand put --qualifier LATEST --max 1
.
Sample output:
fc-deploy-test:
resource: services/fc-deploy-service.http-trigger-py36/functions/LATEST
maximumInstanceCount: 1
-
The
AliyunFCReadOnlyAccess
permission policy is required to run theondemand list
orondemand get
command. -
The following permission policy is required to run the
ondemand put
command:{ "Version": "1", "Statement": [ { "Action": "fc:PutFunctionOnDemandConfig", "Effect": "Allow", "Resource": "acs:fc:<region>:<account-id>:services/services/<serviceName>.<qualifier>/functions/<functionName>" } ] }