tencent cloud

Feedback

Installation and configuration

Last updated: 2022-03-18 15:55:56
This document is currently invalid. Please refer to the documentation page of the product.

    Installing CLI (Windows)

    Method 1: Installing using command

    1. For more information on how to install Python 2.7 or 3.6+ version, see Python installation tutorial.
    2. Run the pip install scf command to install CLI.
    3. CLI can be upgraded by running the pip install -U scf command.

    Method 2: Quick installation

    1. Download the SCF CLI installation package via CLI Download.

      If this method is used, you need to get the latest installation package and reinstall it to upgrade CLI.

    2. Right-click the downloaded "scfcli.exe" file and select Run as administrator to install it.
    3. Run the scf --version command to verify whether CLI installation is successful.
      scf CLI, version 0.0.1
      

    If a message similar to the one above is returned, the installation is successful.

    Installing CLI (macOS/Linux)

    1. For more information on how to install Python 2.7 or 3.6+ version, see Python installation tutorial.

    2. Run the following command to check the Python version.

      Python --version
      
    3. Run the following command to install SCF CLI.

      pip install scf
      
    4. Run the following command to verify whether TCCLI is successfully installed:

      scf --version
      

    If a message similar to the one below is returned, the installation is successful.

    scf CLI, version 0.0.1
    

    Configuring account information

    After installing SCF CLI, you need to perform initial configuration to input the account information in the SCF CLI configuration file for future use.

    Getting configuration information

    The configuration items include the default region, account ID, SecretID, and SecretKey, which can be obtained as shown below:

    • Region: The region where you want to use the product. For the list of regions and corresponding abbreviations, see Click Here. You only need to enter the region rather than the AZ.
    • Account ID: APPID. You can go to Account Center > Account Information in the console to view you account ID. Please copy and paste it into the notepad for later use.
    • SecretID and SecretKey: Secret ID and secret key of TencentCloud API. You can obtain them or create new ones by going to the CAM Console and selecting TencentCloud API Key > API Key Management. Please copy and paste them into the notepad for later use.

    Configuration Operation

    SCF CLI offers two options: "interactive configuration" and "non-interactive configuration". You can choose based on your needs.

    Interactive Configuration:

    Run the scf configure set command to configure the obtained information into SCF CLI or modify a configuration item.
    For example, if you want to use SCF CLI in Guangzhou and the obtained account ID, SecretId, and SecretKey are 1253970223, AKIxxxxxxxxxx, and uxxlxxxxxxxx, respectively, you can run the following command to configure SCF CLI.

    using-cos indicates whether COS is used for deployment. It is disabled by default, but we recommend that you enable it to significantly speed up the deployment. If the frequency is high and packages are large (such as tens of thousands of deployments or packages of several GB), using COS may incur fees. For more information, see COS Free Tier.

    Run the following command and enter the corresponding information:

    $ scf configure set
    "appid": "1253970026"
    &Region=ap-guangzhou
    [-] secret-id = ********************************cEr7
    [-] secret-key = ****************************mkYA
    [-] using-cos = True (By default, it is deployed by COS.)
    Allow report information to help us optimize scfcli(Y/n):
    

    Non-interactive Configuration:
    (You can skip this step if configuration is already completed) You can also run the following command with parameters appended for configuration.

    $ scf configure set --region ap-beijing --appid xxxxxxxxxx --secret-id xxxxxxxxxxxxxx --secret-key xxxxxxxxxxxxxx
    

    Modifying Configuration

    You can run scf configure set --modification to modify a configuration item. For example, you can change the region to Shanghai by running the following command:

    $ scf configure set --region ap-shanghai
    

    When modifying the using-cos configuration item, please note that:

    • To enable this option, run the scf configure set --using-cos y command.
    • To disable it, run the scf configure set --using-cos n command.

    Configuration Query

    Run the following command to obtain the configuration information.

    $ scf configure get
    

    A message similar to the one below will be returned:

    "appid": "1253970026"
    Python2-path = None
    Python3-path = None
    &Region=ap-guangzhou
    secret-id = xxxxxxxxxxxxxxxx
    secret-key = xxxxxxxxxxxxxxxx
    using-cos = True (By default, it is deployed by COS.)
    

    You can also view all the configuration information in ~/.tcli_config.ini .

    Upgrading SCF CLI

    If you use a Windows installation package to install SCF CLI, you can upgrade it using the same method.

    If you have already installed SCF CLI, you can upgrade it to the latest version by the following steps.

    Installing via pip

    Run the following command to upgrade SCF CLI.

    $ pip install -U scf
    
    

    Installing with Windows installation packages

    You need to download the latest installation package via the Download Page, right-click on Run as administrator.
    Run the $ scf --version command to verify whether SCF CLI upgrade is successful.

    $ scf --version
    SCF CLI, version 0.0.1
    

    A message similar to the one above will be returned, where you can view the upgraded version number.

    Installing Python and Pip

    Installing Python

    As SCF CLI is developed in Python, you need to install Python first. You can find the appropriate Python version suitable for your OS to install in Official download guide or Official download page.

    We recommend you install Python 2.7 (and higher) or Python 3.6 (and higher).

    • For Windows and macOS, you can download an installation package directly on Python's official website and install it as a general software program.
    • For Linux, a Python environment has already been embedded in most Linux distributions. If not, you can install Python using a package manager or through the source code.

    For more information, visit Python's official website.

    Installing pip

    After installing the Python environment, you need to install the package manager "pip" for Python, through which you can install and upgrade SCF easily. You can know the simplest way to install pip via Pip's official installation guide:

    1. Run the following command to download the get-pip.py file.
      curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
      

    You can also get the get-pip.py file via Click Here and save it locally.

    1. Run the following command to install pip.

      Python get-pip.py
      
    2. Run the following command to verify whether pip installation is successful.

      $ pip --version
      

    If a message similar to the one below is returned, the installation is successful.

    pip 18.1 from /Library/Python/2.7/site-packages/pip (Python 2.7)
    

    Installing Docker (optional)

    SCF CLI allows you to use the container manager Docker to launch and use containers as the environment for running function code locally. The local invoke command in SCF CLI will use Docker's management APIs to run codes, get execution logs in a container, and more.

    • If you need the local debugging and execution capabilities, please make sure that Docker has been installed properly.
    • If you do not need Docker for now, you can skip this step.

    Installing Docker on Windows

    Virtualization capabilities will be used for installing and running containers on Windows. Windows 7 and earlier versions use different methods to install Docker than Windows 10.

    • For Windows 10 Pro or Enterprise 64-bit
      1. Download docker-ce-desktop for Windows here.
      2. Sign up and log in to the website.
      3. Download the Docker for Windows Installer.
      4. Double-click the installer to start installation.

    After the installation is completed, Docker will launch automatically with a whale icon displayed on the notification bar.

    • For Windows 7 and earlier versions
      If Windows versions are incompatible with Docker Desktop, use Docker Toolbox to install Docker.
      1. Go to the Docker Toolbox overview page and find the Toolbox download address for your Windows version.
      2. Following the Toolbox installation guide for Windows, double-click the installer to install Toolbox. Toolbox is integrated with components such as CLI, Docker Machine, and VirtualBox.
      3. After the installation is completed, double-click the Docker QuickStart icon on the desktop to launch Docker.

    After Docker is launched, a terminal window will appear, where you can enter and run the docker version command to verify whether Docker has been installed and launched successfully.

    Installing Docker on macOS

    • For macOS Sierra 10.12 and higher versions
      1. Download docker-ce-desktop for macOS here.
      2. Download the docker.dmg installation package.
      3. Double-click the installer to start installation.

    After the installation is completed, Docker's whale icon will show on the status bar at the top, meaning that Docker has been launched.

    • For versions below macOS Sierra 10.12
      For versions below macOS Sierra 10.12, use Docker Toolbox to install Docker.
      1. Go to the Docker Toolbox overview page and find the Toolbox download address for your macOS version.
      2. Following the Toolbox installation guide for macOS, double-click the installer to install Toolbox.
      3. After the installation is completed, double-click the new Docker Quickstart Terminal icon on the Launchpad to launch Docker.

    After Docker is launched, a terminal window will appear, where you can enter and run the docker version command to verify whether Docker has been installed and launched successfully.

    Installing Docker on Linux

    You can install Docker using the built-in package manager in your Linux distribution or through a binary package. Below are installation methods for different Linux distributions:

    • *CentOS
      1. Get the Docker installation package for CentOS here.
      2. Run the sudo yum install docker-ce docker-ce-cli containerd.io command to install Docker.
    • Debian
      1. Get the Docker installation package for Debian here.
      2. Run the sudo apt-get install docker-ce docker-ce-cli containerd.io command to install Docker.
    • Fedora
      1. Get the Docker installation package for Fedora here.
      2. Run the sudo dnf install docker-ce docker-ce-cli containerd.io command to install Docker.
    • Ubuntu
      1. Get the Docker installation package for Ubuntu here.
      2. Run the sudo apt-get install docker-ce docker-ce-cli containerd.io command to install Docker.
    • Binary package
      1. Get the binary package here.
      2. Decompress and run the binary package to install and launch Docker.

    FAQ

    For FAQs about installation and usage, see SCF FAQs.

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support