pip install scf
command to install CLI.pip install -U scf
command.
If this method is used, you need to get the latest installation package and reinstall it to upgrade CLI.
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.
For more information on how to install Python 2.7 or 3.6+ version, see Python installation tutorial.
Run the following command to check the Python version.
Python --version
Run the following command to install SCF CLI.
pip install scf
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
After installing SCF CLI, you need to perform initial configuration to input the account information in the SCF CLI configuration file for future use.
The configuration items include the default region, account ID, SecretID, and SecretKey, which can be obtained as shown below:
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
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.
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
.
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.
Run the following command to upgrade SCF CLI.
$ pip install -U scf
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.
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.
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:
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.
Run the following command to install pip.
Python get-pip.py
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)
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.
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.
Docker for Windows Installer
.After the installation is completed, Docker will launch automatically with a whale icon displayed on the notification bar.
Docker Toolbox
to install 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.
After the installation is completed, Docker's whale icon will show on the status bar at the top, meaning that Docker has been launched.
Docker Toolbox
to install 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.
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:
sudo yum install docker-ce docker-ce-cli containerd.io
command to install Docker.sudo apt-get install docker-ce docker-ce-cli containerd.io
command to install Docker.sudo dnf install docker-ce docker-ce-cli containerd.io
command to install Docker.sudo apt-get install docker-ce docker-ce-cli containerd.io
command to install Docker.For FAQs about installation and usage, see SCF FAQs.
Was this page helpful?