Skip to main content

Managing Cloud Functions via Console

Cloud Functions are one of the core features of the cloud development platform. Effective management of Cloud Functions can enhance application performance, reliability, and security. This document will guide you on managing the lifecycle of Cloud Functions through the console.

Management Method

You can manage Cloud Functions in the following two ways:

This document primarily focuses on the console management approach. For CLI management, please refer to Managing Cloud Functions via CLI.

Creating Cloud Functions

Create via Console

  1. Log in to the Cloud Development Platform and go to the Cloud Functions Management Page
  2. Click the "New Cloud Function" button
  3. Fill in the function name, runtime environment, function description, and other information.
  4. Select a function template or write code from scratch
  5. Click "OK" to complete the creation

Cloud Function Creation Page

Development and Deployment

Online Editing and Deployment

You can directly edit Cloud Function code in the Cloud Development Console:

  1. On the Cloud Functions Management Page, choose the target function
  2. Modify the code in the code editor
  3. Click "Save and Install Dependencies" to complete the deployment

Online Function Code Editing

Deploying by Uploading Code Packages

For more complex projects, you can package and upload the code:

  1. Package the function code and dependencies into a ZIP file
  2. On the Cloud Function details page, select "Upload ZIP Package"
  3. Select the local ZIP file and upload it
  4. Click "Save and Install Dependencies" to complete the deployment
Tip

The root directory of the ZIP package should contain the entry file, such as index.js in a Node.js environment.

Function Configuration

On the Cloud Functions Management Page, choose the target function, click the "Configuration" tab, and you can adjust the following configuration items:

Basic Configuration

Configuration ItemDescriptionDefault ValueAllowed Values
Memory ConfigurationThe maximum memory limit for the Cloud Function runtime256MB128MB - 2048MB
TimeoutMaximum function execution time; function will be forcibly terminated upon timeout20s1s - 900s
Environment VariablesEnvironment variables defined in key/value pairsNoneCustom
Caution

Memory configuration affects function performance and billing. Set it appropriately based on actual requirements.

Network Configuration

Public Network Access

Cloud Functions have public network access enabled by default. You can disable it based on security requirements. Once disabled, the function will be unable to access public network resources.

Private Network Access (VPC Configuration)

You can configure Cloud Functions to access the VPC private network:

  • No VPC configured: Function instances run in an isolated network environment and have access to the public network
  • VPC configured: Function instances run in the specified VPC network and can access resources within the VPC
Tip

Fixed Egress IP

After enabling this feature, Cloud Functions will be assigned a fixed public network egress IP, which will be shared with other functions in the same namespace that have this feature enabled.

Tip

The fixed egress IP feature can take effect only when public network access is enabled for Cloud Functions.

Rate Limiting Configuration

Cloud Functions supports configuring access rate limiting to help you control function invocation frequency, preventing malicious calls and resource abuse:

  • Rate Limiting Rules: You can set the maximum number of invocations per second, per minute, or per hour.
  • Rate Limiting Policy: Supports rate limiting control based on dimensions such as IP and User ID.
  • Overlimit Handling: When the invocation frequency exceeds the limit, the system returns a corresponding error message.
Tip

Properly configuring rate limiting rules can effectively protect your Cloud Functions from malicious attacks while controlling costs. For detailed configuration methods, refer to the Rate Limiting Feature Configuration Guide.

Provisioned Concurrency Configuration

Provisioned Concurrency is an advanced feature of Cloud Functions that pre-launches a specified number of function instances to effectively resolve cold start issues:

Features

  • Eliminates cold start: Pre-provisioned instances remain in a running state at all times, enabling immediate request processing upon arrival.
  • Performance improvement: Eliminates instance startup time and significantly improves response speed.
  • Cost optimization: Billing based on the running time of provisioned instances, suitable for high-frequency access scenarios

Configuration Method

  1. On the Cloud Function details page, choose the "Provisioned Concurrency" tab
  2. Set the number of provisioned concurrency instances
  3. Configure the version or alias for provisioned concurrency
  4. Click "Save" to complete the configuration
Tip
  • Provisioned Concurrency is suitable for scenarios with stable traffic volume and high requirements for response time.
  • Provisioned instances incur continuous charges; please configure the quantity reasonably based on actual business needs.

Function Monitoring

View Runtime Logs

On the Cloud Function details page, choose the "Logs" tab:

  1. Set the time range and log level:
  2. View function execution logs and error messages
  3. Supports real-time log viewing and historical log search

Monitoring Metrics

On the Cloud Function details page's "Monitoring" tab, you can view the following key metrics:

  • Invocations
  • Error Count
  • Average Execution Time
  • Memory Usage

Delete Cloud Function

Delete via the console

  1. On the Cloud Functions Management Page, locate the target function
  2. Click "More" → "Delete"
  3. Enter the function name in the confirmation dialog to confirm deletion
Warning

Deleting cloud functions cannot be undone. The function will become inaccessible after deletion. Please proceed with caution.

Using CLI to Manage

If you need to use the command-line tool for automated deployment and batch management, please refer to the CLI Management of Cloud Functions documentation.

Frequently Asked Questions

What to Do If Cloud Function Deployment Fails?

  1. Check the code for syntax errors
  2. Verify that the dependencies are compatible with the cloud function environment
  3. View the deployment logs and locate the specific cause of the error
  4. Try to reduce the deployment package size, as cloud functions have size limits for deployment packages

How to Resolve Cloud Function Execution Timeout

  1. Increase the function timeout setting
  2. Optimize code execution efficiency
  3. For long-running tasks, consider splitting them into multiple functions or using asynchronous execution

How to Handle Cloud Function Cold Start Issues

  1. Keep function code concise and reduce unnecessary dependencies
  2. Use provisioned concurrency instances
  3. Periodically warm up functions to keep them active

How to Access a Database from Cloud Functions

Cloud functions can directly access the CloudBase database via the SDK without additional authentication configuration. Sample code:

const tcb = require('@cloudbase/node-sdk');
const app = tcb.init();
const db = app.database();

exports.main = async (event, context) => {
const collection = db.collection('users');
const result = await collection.get();
return result;
};

For more Cloud Functions related questions, please refer to Cloud Functions FAQ.