Service is the unit for managing Function Compute resources. All functions belonging to a service share some common settings, such as authorization and log configuration. You can use the console or command line tool to create services.
When creating a service, specify the following attributes:
serviceName (required): Name of the service. It must be unique in one Alibaba Cloud account and meets the following restrictions:
The name must consist of English letters (a–z) (A–Z), numbers (0–9), underscores (_), and hyphens (-).
The first character must be an English letter (a–z) (A–Z) or underscore (_).
The name is case-sensitive.
The name must contain 1–128 characters.
description (optional): Description of the service.
role (optional): The role grants Function Compute permissions to access user’s cloud resources or run functions which may access cloud resources. For example:
Use your Log Service resource to store function execution logs.
Run the functions that need to access other cloud resources.
For more information about the role, see Function Compute role management.
logConfig (optional): Sets the Log Service project and LogStore which are used to store function execution logs.
- If you have not configured this attribute, you cannot view the function execution logs. We recommend that you enable Log Service and set this attribute.
Note: The log configuration uses Alibaba Cloud Log Service. Log Service charges certain resource reservation fees, which means that even if you do not write any logs, you still pay fees. For more information, see Log Service charging description.
vpcConfig (optional): Sets the VPC config to enable VPC access for your functions.
internetAccess (optional): Sets it true to enable internet access for your functions.
Except for the service name, other attributes can be updated later.
In shell mode of the command line tool, you can run
mks/ups to create or update service, and run
info to view the service attributes.
In the following example, the service “my-service” is created, and the description and logConfig attributes are updated. Then, Function Compute is authorized to access the log resources.
Create the service.
Note: You can provide the service description and configuration together when creating the service. This service is created with name only to demonstrate the subsequent update operation.
Create a Log Service project and LogStore.
mkl -p fc-log-project -s fc-log-store
Update the service.
ups my-service -d "this is my service" -p fc-log-project -l fc-log-store
View the service.