You can log on to the function instance by using the Function Compute console or SDK and execute the corresponding command line operations. This topic describes how to log on to a function instance in the console and run the corresponding command.

Background information

An instance is the execution environment of a request. Before a request starts to execute, the Function Compute assigns the most appropriate instance to each request. After the request is executed, the idle instance is released.

The command-line operation function of an instance supports executing specified commands in the real running environment of the instance. For example, you can log on to the instance to view the environment information of the instance, or use tools such as profiling or coredump to collect context information to optimize performance.

Usage notes

  • Only instance command line operations can be performed on instances that are still alive, including resident instances in reserved mode and active instances in pay-as-you-go mode. If the idle timeout of the instance in pay-as-you-go mode is released, the instance cannot be executed.
  • Requests for instance command-line operations do not occupy the concurrency of the instance. Therefore, even if the instance concurrency of the function is set to 1, you can perform command-line operations that call the function and the instance at the same time.
  • An instance command line operation is treated as a function call. As long as the WebSocket connection established by the instance command line operation request is not disconnected from the function instance, the function instance will remain active and use the same metering rules as calling the function. When you use the console to operate, the function instance will be disconnected after 10 minutes of idle by default.
  • Initiate an instance command line operation on an instance that is performing an online request. Changes in the online environment may cause the tasks that are being executed on the instance to fail and directly affect the success rate of subsequent tasks for the instance.
    Notice If the request fails to be executed due to a command line operation on the instance, it will not be counted in the product SLA.


Turn on instance-level monitoring metrics for the service. For more information, see Configure logging.


  1. Log on to the Function Compute console.
  2. In the left-side navigation pane, click Services and Functions.
  3. In the top navigation bar, select the region where the service resides.
  4. On the Services page, click the target service.
  5. On the Functions page, click the target function.
  6. On the function details page, click the Metrics > Instance Metrics tab.
  7. On the Instance Metrics tab, find the target instance ID and click Log On to Instance (public preview) in the Actions column.

    You can also click the ID of the target instance. In the upper-right corner of its details page, click Log On to Instance (public preview).

  8. In the Tips dialog box that appears, read the tips carefully and click I am aware of risks.
    The page is redirected to the CLI page of the instance after you log on. You can run the corresponding commands as needed. instance_cli


You can also call the Function Compute SDK to perform command-line operations on the instance. For more information about SDKs, see Supported SDKs.