ALIYUN::FC::Service is used to create a service. All functions of a service share the same settings, such as service authorization and log configurations. A service can have multiple functions, all of which share service resources, such as Logstores and RAM roles.
A service helps you clearly organize your business logic and serves as the basic unit for O&M management. A service can represent an application. The functions that are used in the same application belong to a single service. Services are independent of each other and cannot share resources with each other.
Syntax
{
"Type": "ALIYUN::FC::Service",
"Properties": {
"Description": String,
"VpcConfig": Map,
"ServiceName": String,
"Role": String,
"DeletionForce": Boolean,
"Tags": List,
"NasConfig": Map,
"LogConfig": Map,
"TracingConfig": Map,
"InternetAccess": Boolean,
"VpcBindings": List
}
}
Properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
Description | String | No | Yes | The description of the service. | None |
VpcConfig | Map | No | Yes | The configurations of the virtual private cloud (VPC). The configurations allow functions to access the specified VPC. | For more information, see VpcConfig properties. If you want to delete the VPC configurations when you update a stack, set this property to the following value:
|
ServiceName | String | Yes | No | The name of the service. | The name must be 1 to 128 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). The name must start with a letter or an underscore (_). |
Role | String | No | Yes | The Alibaba Cloud Resource Name (ARN) of the RAM role that is used to grant the required permissions to Function Compute. | You can use the RAM role in the following scenarios:
|
NasConfig | Map | No | Yes | The configurations of Apsara File Storage NAS (NAS). The configurations allow functions to access the specified NAS resources. | For more information, see NasConfig properties. If you want to delete the NAS configurations when you update a stack, set this property to the following value:
|
LogConfig | Map | No | Yes | The log configurations. The function execution logs are written to a Logstore that you specify in the configurations. | For more information, see LogConfig properties. |
TracingConfig | Map | No | Yes | The configuration of Tracing Analysis. | After Function Compute is integrated with Tracing Analysis, you can record the duration of a request in Function Compute, view the cold start time of a function, and record the execution duration of a function. For more information, see TracingConfig properties. |
InternetAccess | Boolean | No | Yes | Specifies whether functions can access the Internet. | Valid values:
|
DeletionForce | Boolean | No | Yes | Specifies whether to forcefully delete the service. | This property takes effect when you specify the VpcConfig property. Default value: false. Valid values:
If the service is created based on a vSwitch or security group created in the current stack, you do not need to specify the DeletionForce property when you delete the service. After you delete the service, you cannot invoke the functions of the service within 1 hour. This way, the ENIs and the stack can be deleted as expected. |
Tags | List | No | Yes | The tags of the service. | You can specify up to 20 tags. For more information, see Tags properties. |
VpcBindings | List | No | Yes | The list of VPC IDs that you bind to Function Compute. | By default, you can use public endpoints and private endpoints to invoke functions after the functions are created. If you want to invoke a function over the specified VPC, you must bind the VPC to Function Compute. You can specify up to 20 VPC IDs. |
LogConfig syntax
"LogConfig": {
"Project": String,
"Logstore": String,
"EnableRequestMetrics": Boolean,
"LogBeginRule": String
}
LogConfig properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
Project | String | No | Yes | The name of the project in LogHub. | None |
Logstore | String | No | Yes | The name of the Logstore in LogHub. | None |
EnableRequestMetrics | Boolean | No | Yes | Specifies whether to enable request monitoring. | Valid values:
|
LogBeginRule | String | No | Yes | The log segmentation rule. | None |
VpcConfig syntax
"VpcConfig": {
"SecurityGroupId": String,
"VSwitchIds": List,
"VpcId": String
}
VpcConfig properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
SecurityGroupId | String | Yes | Yes | The ID of the security group. | None |
VSwitchIds | List | Yes | Yes | The list of vSwitch IDs. | Separate multiple IDs with commas (,). |
VpcId | String | Yes | Yes | The ID of the VPC. | None |
NasConfig syntax
"NasConfig": {
"MountPoints": List,
"UserId": Integer,
"GroupId": Integer
}
NasConfig properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
MountPoints | List | Yes | Yes | The mount target. | For more information, see MountPoints properties. |
UserId | Integer | Yes | Yes | The ID of the Alibaba Cloud user. | Valid values: -1 to 65534. |
GroupId | Integer | Yes | Yes | The ID of the user group. | Valid values: -1 to 65534. |
TracingConfig syntax
"TracingConfig": {
"Type": String,
"Params": Map
}
TracingConfig properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
Type | String | No | Yes | The type of the tracing system. | None |
Params | Map | No | Yes | The parameters of Tracing Analysis. | None |
MountPoints syntax
"MountPoints": [
{
"ServerAddr": String,
"MountDir": String
}
]
MountPoints properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
ServerAddr | String | Yes | Yes | The address of the NAS server. | None |
MountDir | String | Yes | Yes | The local mount directory. | None |
Tags syntax
"Tags": [
{
"Key": String,
"Value": String
}
]
Tags properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
Key | String | Yes | No | The key of the tag. | The tag key must be 1 to 128 characters in length, and cannot contain http:// or https:// . The tag key cannot start with acs: or aliyun . |
Value | String | No | No | The value of the tag. | The tag value can be up to 128 characters in length, and cannot contain http:// or https:// . The tag value cannot start with aliyun or acs: . |
Return values
Fn::GetAtt
- ServiceId: the unique ID that is generated by the system for a service.
- ServiceName: the name of the service.
- Tags: the tags of the service.
- Role: the RAM role.
- LogProject: the log project.
- Logstore: the Logstore.
- InternetAccess: indicates whether the Internet can be accessed by functions.
- VpcId: the ID of the VPC.
Examples
JSON
format{ "ROSTemplateFormatVersion": "2015-09-01", "Description": "Test FC", "Parameters": { }, "Resources": { "Service": { "Type": "ALIYUN::FC::Service", "Properties": { "ServiceName": "mytest" } } }, "Outputs": { } }
For more examples, visit FunctionInvoker.json and FunctionInvoker.yml. In the examples, the following resource types are used: ALIYUN::FC::Service, ALIYUN::FC::Function, ALIYUN::FC::FunctionInvoker, ALIYUN::FC::Trigger, ALIYUN::FC::Version, ALIYUN::FC::Alias, and ALIYUN::FC::ProvisionConfig.