Serverless computing has revolutionized how developers think about deploying and scaling applications. With Alibaba Cloud Function Compute, you write code as small, event-driven functions and let Alibaba handle all the infrastructure—no server setup, patching, or worrying about scalability. This guide will walk you through the essentials: what Function Compute is, how to create your first function, connect triggers, integrate with other cloud resources, and optimize your architecture for production.

Function Compute lets you execute code in response to events:
● HTTP requests (APIs)
● OSS bucket uploads or deletes
● Timer/Cron schedules (every hour, every day, etc.)
● Message queue/events
You upload code (Python, Node.js, Java, and more), configure triggers, and Alibaba Cloud automatically handles provisioning, scaling, and monitoring. You only pay for the milliseconds your code actually runs.
npm install -g @serverless-devs/s
s config add # Add your Alibaba Cloud credentials
s init devsapp/start-fc-http-python3
cd start-fc-http-python3
def handler(event, context):
return {
'statusCode': 200,
'headers': {'Content-Type': 'application/json'},
'body': '{"message": "Hello from Alibaba Cloud Function Compute!"}'
}
This simple function responds to any HTTP request with a JSON greeting.
Have your function respond when files are uploaded to OSS:
def handler(event, context):
# For each file event
for ev in event['events']:
bucket = ev['oss']['bucket']['name']
key = ev['oss']['object']['key']
print(f"Received file {key} in bucket {bucket}")
Great for auto-processing images, PDFs, or backups.
Run code on a schedule (e.g., analytics every hour):
def handler(event, context):
import datetime
print("Function triggered at", datetime.datetime.now())
import pymysql
def save(data):
conn = pymysql.connect(host='host', user='user', password='pwd', db='mydb')
with conn.cursor() as cursor:
cursor.execute("INSERT INTO customers (name,email) VALUES (%s,%s)", (data['name'], data['email']))
conn.commit()
Use environment variables for connection settings and secrets:
import os
db_host = os.environ.get('DB_HOST')
Good logging improves debugging and monitoring.
import logging
def handler(event, context):
logger = logging.getLogger()
try:
# Main logic
pass
except Exception as e:
logger.error("Error: " + str(e))
return {'statusCode': 500, 'body': '{"error":"Internal error"}'}
s deploy
Monitor invocations, latency, and errors in the Function Compute console.
● Size functions (memory/time) for your workload, not too big or small.
● Use environment variables for configuration.
● Add alerting for errors or high latency.
● Secure triggers—e.g., API authentication.
A company wants to process images uploaded by users:
Serverless makes such orchestration easy, massively scalable, and affordable—because you only pay when your code runs.
Alibaba Cloud Function Compute lets you quickly build APIs, data pipelines, scheduled jobs, and integrations that scale to millions of events per day without managing infrastructure.
Disclaimer: The views expressed herein are for reference only and don't necessarily represent the official views of Alibaba Cloud.
Building Scalable Database Solutions with Alibaba Cloud RDS
17 posts | 0 followers
FollowAlibaba Clouder - June 16, 2020
Alibaba Clouder - November 11, 2020
Alibaba Clouder - April 7, 2021
Alibaba Clouder - June 2, 2020
Alibaba Developer - January 21, 2021
Alibaba Clouder - March 19, 2019
17 posts | 0 followers
Follow
Function Compute
Alibaba Cloud Function Compute is a fully-managed event-driven compute service. It allows you to focus on writing and uploading code without the need to manage infrastructure such as servers.
Learn More
Serverless Workflow
Visualization, O&M-free orchestration, and Coordination of Stateful Application Scenarios
Learn More
Serverless Application Engine
Serverless Application Engine (SAE) is the world's first application-oriented serverless PaaS, providing a cost-effective and highly efficient one-stop application hosting solution.
Learn More
ECS(Elastic Compute Service)
Elastic and secure virtual cloud servers to cater all your cloud hosting needs.
Learn MoreMore Posts by Farah Abdou