Lithops with Aliyun Function Compute as serverless compute backend.
- Install Alibaba Cloud backend dependencies:
python3 -m pip install lithops[aliyun]
- Access to your console and activate your Functions service instance.
-
Navigate to the Cloud Console and create a new AccessKey (If you don't have one)
-
Access to your Function Compute dashboard, and choose your preferred region.
-
Access to the Resource Access Management (RAM) Roles dashboard, and create a new Role that contains the
AliyunOSSFullAccess
permission. Alternatively you can use an already created Role that contains theAliyunOSSFullAccess
permission. -
Edit your Lithops config and add the following keys:
lithops:
backend : aliyun_fc
aliyun:
account_id: <ACCOUNT_ID>
access_key_id: <ACCESS_KEY_ID>
access_key_secret: <ACCESS_KEY_SECRET>
region : <REGION_NAME>
aliyun_fc:
role_arn: <ROLE_ARN>
- (optional) By default Lithops will automatically create a new service in your Function Compute account. For this purpose your user must have List and Create permissions to Function Compute. Alternatively, you can create a new service through the dashboard (or use one already created), assign the Role created in the previous step (Accessing to service configuration --> Modify Configuration --> Role Config), and configure the service entry in the aliyun_cf config section.
Group | Key | Default | Mandatory | Additional info |
---|---|---|---|---|
aliyun | account_id | yes | Alibaba Cloud Account ID | |
aliyun | access_key_id | yes | Access Key Id | |
aliyun | access_key_secret | yes | Access Key Secret | |
aliyun | region | yes | Region name. For example: eu-west-1 |
Group | Key | Default | Mandatory | Additional info |
---|---|---|---|---|
aliyun_fc | role_arn | yes | Role ARN. For example: acs:ram::5244532493961771:role/aliyunfclogexecutionrole |
|
aliyun_fc | region | no | Region name. For example: eu-west-1 . Lithops will use the region set under the aliyun section if it is not set here |
|
aliyun_fc | service | no | Service name | |
aliyun_fc | max_workers | 300 | no | Max number of workers. Alibaba limits the number of parallel workers to 300 |
aliyun_fc | worker_processes | 1 | no | Number of Lithops processes within a given worker. This can be used to parallelize function activations within a worker |
aliyun_fc | runtime | no | Runtime name you built and deployed using the lithops client | |
aliyun_fc | runtime_memory | 256 | no | Memory limit in MB. Default 256MB |
aliyun_fc | runtime_timeout | 300 | no | Runtime timeout in seconds. Default 5 minutes |
aliyun_fc | invoke_pool_threads | 300 | no | Number of concurrent threads used for invocation |
Once you have your compute and storage backends configured, you can run a hello world function with:
lithops hello -b aliyun_fc -s aliyun_oss
You can view the function executions logs in your local machine using the lithops client:
lithops logs poll