Version commands

The version commands are used to perform operations related to function versions. For example, you can view, publish, and delete aliases.

Command description

You can run the version -h or version --help command to obtain help document.

In the preceding command, the following subcommands are included:

version list command

The version list command is used to check a list of published versions.

You can run the version list -h or version list --help command to obtain the help document.

Parameter description

ParameterAbbreviationRequired in YAML modeRequired in CLI modeDescription
region-NoYesThe name of 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-NoYesThe name of the service.
table-NoNoSpecifies whether to return the result in the form of 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

Examples

  • If a resource description file (YAML) is available, you can run the s version list command to check a list of published versions of the service.

  • In CLI mode (no YAML), you must specify the region of the service and the name of the service. Example: s cli fc version list --region cn-hangzhou --service-name fc-deploy-service.

Example output:

fc-deploy-test: 
  - 
    versionId:        1
    description:      test publish version
    createdTime:      2021-11-08T06:07:00Z
    lastModifiedTime: 2021-11-08T06:07:00Z

If the --table parameter is specified, the following output is returned:

  ┌───────────┬──────────────────────┬──────────────────────┬──────────────────────┐
  │ versionId │     description      │     createdTime      │   lastModifiedTime   │
  ├───────────┼──────────────────────┼──────────────────────┼──────────────────────┤
  │ 1         │ test publish version │ 2021-11-08T06:07:00Z │ 2021-11-08T06:07:00Z │
  └───────────┴──────────────────────┴──────────────────────┴──────────────────────┘

version publish command

The version publish command is used to publish a version.

You can run the version publish -h or version publish --help command to obtain the help document.

Parameter description

ParameterAbbreviationRequired in YAML modeRequired in CLI modeDescription
region-NoYesThe name of 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, ap-south-1
service-name-NoYesThe name of the service.
description-NoNoVersion description

The current command also supports some global parameters (such as -a/--access, --debug, etc.). For details, please refer to Serverless Devs global parameters document

Examples

  • **If a resource description file (YAML) is available, **you can run the s version publish command to publish a version.
  • **In CLI mode (no YAML), **you must specify the region of the service and the name of the service. For example, s cli fc version publish --region cn-hangzhou --service-name fc-deploy-service --description "test publish version".

Example output:

fc-deploy-test: 
  versionId:        1
  description:      test publish version
  createdTime:      2021-11-08T06:07:00Z
  lastModifiedTime: 2021-11-08T06:07:00Z

Permissions and policies

  • Policy required for the version list command: AliyunFCReadOnlyAccess.

  • Policy required for the version publish command:

    {
        "Version": "1",
        "Statement": [
            {
                "Action": "fc:PublishServiceVersion",
                "Effect": "Allow",
                "Resource": "acs:fc:<region>:<account-id>:services/<serviceName>/versions"
            }
        ]
    }
    
Edit this page on GitHub Updated at Wed, May 10, 2023