Creating Functions on CLI

Last updated: 2020-11-26 18:25:52

    Overview

    This document describes how to use the SCF component provided by Serverless Framework to quickly create and deploy an SCF project. For more information on components and how to use them, please see Components Overview

    Note:

    The SCF CLI tool has been disused since February 2020. We recommend you use the more rich-featured and convenient Serverless Framework CLI tool for project development.

    Prerequisites

    Directions

    Creating function

    Run the following command to quickly create a function in the Node.js language:

    sls init scf-demo

    Note:

    scf-demo in the command can be replaced with a template for another programming language. Currently, the SCF component supports the following components: go1-helloworld, nodejs1015-helloworld, php72-helloworld, and python36-helloworld.

    Deploying function

    Run the following command in the scf-demo directory to deploy the function:

    sls deploy

    A QR code will pop up. Please scan it to authorize and start deployment. After successful deployment, SCF resources will be automatically created.

    Note:

    If authentication fails, please authorize as instructed in Account and Permission Configuration.

    View function information

    Run the following command to view the information of the deployed SCF resources:

    sls info

    Removing function

    Run the following command to remove the deployed SCF resources:

    sls remove

    Note:

    For more information on how to use Serverless Framework CLI to manipulate SCF functions, please see Serverless Framework CLI.

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help