Unlocking Serverless: Real-World Alibaba Cloud FaaS Use Cases & Deployment Guide
This article explains what serverless computing is, outlines its key advantages and limitations, presents typical use cases such as video transcoding and IoT monitoring, compares it with micro‑services, and provides a step‑by‑step Alibaba Cloud FaaS deployment tutorial using Funcraft scripts and CLI commands.
What Is Serverless Computing?
Serverless Computing (FaaS) lets you build and run applications without managing servers or infrastructure. Applications are broken into fine‑grained functions that are triggered in a cloud environment, automatically scaled, and billed per use. Major cloud providers—including Alibaba Cloud—offer serverless products.
Alibaba Cloud’s Definition of FaaS
Alibaba Cloud describes Function Compute as an event‑driven, fully managed service. You only write and upload code; the platform provisions resources, runs tasks elastically, and provides logging, monitoring, and alerting.
Advantages of Serverless
Developers can focus on business logic without worrying about underlying infrastructure.
Elastic scaling and pay‑as‑you‑go pricing suit workloads with unpredictable traffic spikes.
Being a cloud‑native product, it integrates seamlessly with other cloud services.
Typical Application Scenarios
Based on project experience, two concrete cases are highlighted:
Cloud Video Transcoding
Technical solution: Devices upload short videos to OSS; an OSS trigger launches a Function Compute that runs FFmpeg to add watermarks/effects, transcodes the video, stores the result back to OSS, and notifies the business service.
Advantages: Handles highly variable upload rates and avoids provisioning expensive, always‑on transcoding servers.
IoT Device Monitoring
Technical solution: Devices report status to Alibaba Cloud IoT; the IoT service triggers a Function Compute that cleans the message and forwards it to a backend service or stores it in a NoSQL database.
Advantages: Eliminates the need for a 24/7 backend service and simplifies scaling for bursty device traffic.
Additional typical scenarios include CPU‑intensive batch jobs, elastic web back‑ends, glue‑code for orchestrating cloud resources, and rapid low‑cost agile applications.
When Serverless Is Not a Good Fit
Complex service orchestration, governance, and tracing often require extra work that outweighs serverless benefits.
Limited control over underlying hardware (e.g., no GPU acceleration) can hinder performance‑critical workloads.
Dependencies on specific runtime environments or hardware may cause compatibility issues.
Concurrency limits exist; large‑scale production systems must plan for upper bounds and possible throttling.
Serverless vs. Microservices
Microservices describe an architectural style, while serverless is a deployment model. A microservice can be implemented as a serverless function, but choosing between them depends on the need for complex orchestration, governance, and performance requirements.
Practical Alibaba Cloud FaaS Demo
Project Background : A foreign client needed to migrate a Node.js product‑consultation service from another provider’s serverless platform to Alibaba Cloud FaaS. The original system used API Gateway and a proprietary NoSQL store.
Migration Steps :
Select Alibaba Cloud equivalents (Function Compute, API Gateway, MongoDB).
Refactor code mainly at the event‑handler entry point.
Use the Funcraft tool to script resource creation, configuration, and deployment.
Funcraft Template (YAML)
ROSTemplateFormatVersion: '2015-09-01'
Transform: 'Aliyun::Serverless-2018-04-03'
Resources:
demoService:
Type: 'Aliyun::Serverless::Service'
Properties:
Description: 'This is a faas demo'
Policies:
- AliyunOSSFullAccess
- AliyunRAMFullAccess
- AliyunLogFullAccess
- AliyunApiGatewayFullAccess
- AliyunFCFullAccess
- AliyunMongoDBFullAccess
- AliyunVPCFullAccess
- AliyunECSNetworkInterfaceManagementAccess
VpcConfig:
VpcId: 'vpc-xxxxxx'
VSwitchIds: ['vsw-xxxxxx']
SecurityGroupId: 'sg-xxxxxx'
LogConfig:
Project: sls-demo
Logstore: logstore-demo
demoFunction:
Type: 'Aliyun::Serverless::Function'
Properties:
Handler: index.handler
Runtime: nodejs10
CodeUri: './src'
EnvironmentVariables:
MONGO_URL: mongodb://userx:[email protected]:3717/demoDb
RESULT_TABLE_NAME: demo_table
demoGroup:
Type: 'Aliyun::Serverless::Api'
Properties:
StageName: RELEASE
DefinitionBody:
'/v1/recommendervera/[resultId]':
get:
x-aliyun-apigateway-api-name: demo_api
x-aliyun-apigateway-fc:
arn: acs:fc:cn-shanghai:xxx:services/demoService.LATEST/functions/demoFunction
timeout: 3000
x-aliyun-apigateway-request-parameters:
- apiParameterName: 'resultId'
location: 'Path'
parameterType: 'String'
required: 'REQUIRED'
'/v1/recommendervera/':
post:
x-aliyun-apigateway-api-name: demo_api_post
x-aliyun-apigateway-fc:
arn: acs:fc:cn-shanghai:xxxx:services/demoService.LATEST/functions/demoFunction
timeout: 3000
x-aliyun-apigateway-auth-type: APP
x-aliyun-apigateway-app-code-auth-type: HEADERBuild and Deploy Commands
bash
$ fun build
using template: template.yml
... (build output omitted for brevity) ...
$ fun deploy
using template: ./fun/build/artifacts/template.yml
... (deployment output omitted) ...After deployment, the function and API are reachable and can be integrated into CI/CD pipelines (Jenkins, GitLab, etc.).
Key Deployment Notes
When the function accesses MongoDB, a VPC, VSwitch, and dedicated security group must be configured and added to MongoDB’s whitelist.
All required resources (VPC, switch, security group) are defined in the Funcraft template.
Conclusion
Serverless computing is maturing, and more users are adopting Alibaba Cloud FaaS for building scalable, low‑maintenance applications. This guide covered serverless advantages, unsuitable scenarios, a comparison with microservices, and a complete end‑to‑end migration and deployment example.
Alibaba Cloud Native
We publish cloud-native tech news, curate in-depth content, host regular events and live streams, and share Alibaba product and user case studies. Join us to explore and share the cloud-native insights you need.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
