The ALIYUN::FC::Trigger type specifies how a function is triggered.
In an event-driven computing model, an event source produces events and a function handles them. A trigger provides a centralized and unified way to manage different event sources. When an event occurs, the event source invokes the function associated with the trigger if the event meets the trigger's rules.
Syntax
{
"Type": "ALIYUN::FC::Trigger",
"Properties": {
"TriggerConfig": Map,
"InvocationRole": String,
"FunctionName": String,
"ServiceName": String,
"TriggerName": String,
"TriggerType": String,
"Qualifier": String,
"SourceArn": String
}
}Properties
Property Name | Type | Required | Update allowed | Description | Constraints |
ServiceName | String | Yes | No | The name of the service. | The value must be 1 to 128 characters in length. |
FunctionName | String | Yes | No | The name of the function for which to create the trigger. | None |
TriggerName | String | Yes | No | The name of the trigger. | The value must be 1 to 128 characters in length. It must start with a letter or an underscore (_) and can contain digits, letters, hyphens (-), and underscores (_). |
TriggerType | String | Yes | No | The type of the trigger. | Valid values:
|
TriggerConfig | Map | Yes | Yes | The trigger configuration. | The trigger configuration varies based on the trigger type. |
InvocationRole | String | No | Yes | The role that grants the event source the permission to run the function on your behalf. For example: | This parameter is not required for time triggers and HTTP triggers. It is required for all other trigger types. The trusted entities and policies that can be authorized for different types of trigger roles are as follows:
|
SourceArn | String | No | No | The Alibaba Cloud Resource Name (ARN) of the event source. | This parameter is not required for time triggers and HTTP triggers. It is required for all other trigger types. The ARN formats and examples for different triggers are as follows:
Note
|
Qualifier | String | No | Yes | Trigger version. | Default value: LATEST. |
oss-TriggerConfig syntax
"TriggerConfig": {
"BucketName": String,
"Events": List,
"Filter": Map
} oss-TriggerConfig properties
Property name | Type | Required | Update allowed | Description | Constraints |
BucketName | String | Yes | No | The name of the bucket. | Select a bucket in Object Storage Service (OSS) as the event source. The selection box displays buckets in the same region. |
Events | String | Yes | Yes | The triggering event, which is an operation that you perform on an Alibaba Cloud resource. | Example: |
Filter | Map | No | Yes | The trigger rule, which is used to prevent trigger loops. | The values of Prefix and Suffix are custom strings. Example: |
log-TriggerConfig syntax
"TriggerConfig": {
"SourceConfig": Map,
"LogConfig": Map,
"JobConfig": Map,
"FunctionParameter": Map,
"Enable": Boolean
}log-TriggerConfig properties
Property Name | Type | Required | Update allowed | Description | Constraints |
SourceConfig | Map | Yes | No | The configuration of the Logstore. | Example: |
LogConfig | Map | Yes | Yes | The configuration of the log project and trigger logs. | The log project must be specified and cannot be updated. The trigger log is optional and can be updated. The trigger log cannot be the same as the Logstore specified in SourceConfig. Example: |
JobConfig | Map | Yes | Yes | The job configuration, which is used to set the maximum number of retries and the trigger interval. | The trigger interval is measured in seconds. The maximum number of retries can range from 0 to 100. Example: |
FunctionParameter | Map | Yes | Yes | The function configuration, which is used to pass parameters to the function. | Enter braces ({}) if no parameters are specified. |
Enable | Boolean | Yes | Yes | The status of the Simple Log Service trigger. | Valid values:
|
timer-TriggerConfig syntax
"TriggerConfig": {
"Payload": String,
"CronExpression": String,
"Enabled": Boolean
}timer-TriggerConfig properties
Property Name | Type | Required | Update allowed | Description | Constraints |
Payload | String | No | Yes | The trigger message. | None |
CronExpression | String | Yes | Yes | The cron expression, which is used to set the trigger time. | The cron expression runs in UTC, which is 8 hours behind UTC+8. For more information, see CronExpression. |
Enabled | Boolean | Yes | Yes | Indicates whether to enable the trigger. | Valid values:
|
tablestore-TriggerConfig syntax
"TriggerConfig": {
"InstanceName": String,
"TableName": String
}tablestore-TriggerConfig properties
Property Name | Type | Required | Update allowed | Description | Constraints |
InstanceName | String | Yes | No | The name of the Tablestore instance. | None |
TableName | String | Yes | No | The name of the data table. | None |
mns_topic-TriggerConfig syntax
"TriggerConfig": {
"NotifyStrategy": String,
"NotifyContentFormat": String,
"FilterTag": String
}mns_topic-TriggerConfig properties
Property Name | Type | Required | Update allowed | Description | Constraints |
NotifyStrategy | String | Yes | No | The retry policy. | Valid values:
For more information, see NotifyStrategy. |
NotifyContentFormat | String | Yes | No | The event format. | Valid values:
|
FilterTag | String | No | No | The filter tag. | None |
cdn-TriggerConfig syntax
"TriggerConfig": {
"EventName": String,
"EventVersion": String,
"Notes": String,
"Filter": List
}cdn-TriggerConfig properties
Property Name | Type | Required | Update allowed | Description | Constraints |
EventName | String | Yes | No | The triggering event. | Valid values:
|
EventVersion | String | Yes | No | The version of the triggering event. | None |
Notes | String | Yes | Yes | Notes. | None |
Filter | List | Yes | Yes | The filter. | The key for each filter is |
http-TriggerConfig syntax
An HTTP trigger can be created only when you create a function. It cannot be used with triggers of other types.
"TriggerConfig": {
"AuthType": String,
"Methods": List
}http-TriggerConfig properties
Property Name | Type | Required | Update allowed | Description | Constraints |
AuthType | String | Yes | No | The authentication method. | Valid values:
|
Methods | List | Yes | No | The request methods. | Valid values:
Example: |
Return value
Fn::GetAtt
TriggerId: The unique ID of the trigger.
ServiceName: The name of the service.
FunctionName: The name of the function.
TriggerName: The name of the trigger.
UrlInternet: The public endpoint.
UrlIntranet: The private endpoint.