You can connect to an instance from the Function Compute console or by using Function Compute SDK and manage the instance in the command-line interface (CLI). This topic describes how to connect to an instance from the Function Compute console and run commands on the instance.
- You can run commands only on live instances, which include long-running provisioned instances and active on-demand instances. If an on-demand instance is idle for the specified period, the instance times out and is released. After the instance is released, you can no longer run commands on the instance.
- CLI-based instance management requests do not occupy the concurrency quota of an instance. Even if the Single Instance Concurrency parameter is set to 1 for a function, you can invoke the function and manage an instance of the function by using the CLI at the same time.
- Each command that you run on an instance is considered as a function invocation. If you establish a WebSocket connection to an instance for CLI-based management, the instance stays active until you terminate the connection. You are charged based on the same metering rules for function invocations. If you connect to an instance from the Function Compute console for CLI-based management, the instance is disconnected after it is idle for 10 minutes by default.
Before you begin
- On the Functions page, click the desired function.
- On the Function Details page, click the Instances tab, find the desired instance ID, and then click Connect to Instance in the Actions column.
- In the Note message, read the message and click I understand the risks. You are redirected to the CLI page of the instance. You can run commands based on your business requirements.
You can also use Function Compute SDK to perform CLI-based management on instances. For more information about Function Compute SDK, see Supported SDKs.