ALIYUN::FC::Service

更新时间:
复制 MD 格式

ALIYUN::FC::Service creates a Function Compute service.

All functions in a service share configurations such as authorization and logging, and resources such as Logstores and RAM roles. A service is the basic O&M unit and represents an application. Functions that build the same application belong to one service. Services are independent and do not share resources.

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,
    "OssMountConfig": Map
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

Description

String

No

Yes

The description of the service.

None.

VpcConfig

Map

No

Yes

The VPC configurations that allow functions to access the specified VPC.

VpcConfig properties.

To delete VPC configurations during a stack update:

{
 "VpcId": "",
 "VSwitchIds": [],
 "SecurityGroupId": ""
}
Note

Function Compute requires ENI management permissions for VPC access. Grant the ecs:CreateNetworkInterface permission to Function Compute.

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 (-). It must start with a letter or an underscore (_).

Role

String

No

Yes

The ARN of the RAM role that grants permissions to Function Compute.

The RAM role is used in the following scenarios:

  • Send function execution logs to your Logstore.

  • Generate a token for the function to access other cloud resources during invocation.

NasConfig

Map

No

Yes

The NAS configurations that allow functions to access the specified NAS resources.

NasConfig properties.

To delete NAS configurations during a stack update:

{
 "MountPoints": [],
 "UserId": -1,
 "GroupId": -1
}

LogConfig

Map

No

Yes

The log configurations. Function logs are written to the specified Logstore.

LogConfig properties.

TracingConfig

Map

No

Yes

The configurations of Managed Service for OpenTelemetry.

Enables request duration recording, cold start tracking, and function execution duration monitoring.

TracingConfig properties.

InternetAccess

Boolean

No

Yes

Specifies whether the functions can access the Internet.

Valid values:

  • true

  • false

DeletionForce

Boolean

No

Yes

Specifies whether to forcefully delete the service.

This property takes effect when VpcConfig is specified. Valid values:

  • true: forcefully deletes the service before all ENIs created by Function Compute are removed.

    Note

    If the service uses a vSwitch or security group specified in the ALIYUN::FC::Service resource type, set DeletionForce to true to reduce deletion wait time.

  • false (default): waits until all ENIs created by Function Compute are deleted before deleting the service.

If the service uses a vSwitch or security group created in the current stack, you do not need to specify DeletionForce. After deletion, ensure that the service functions are not invoked within 1 hour so that ENIs and the stack are deleted as expected.

Tags

List

No

Yes

The tags.

You can add up to 20 tags.

Tags properties.

VpcBindings

List

No

Yes

The VPC IDs to bind to Function Compute.

By default, functions can be invoked through public and private endpoints. To invoke functions over specific VPCs, bind those VPCs to Function Compute.

You can specify up to 20 VPCs.

OssMountConfig

Map

No

Yes

The OSS mount configurations.

OssMountConfig property.

LogConfig syntax

"LogConfig": {
  "Project": String,
  "Logstore": String,
  "EnableRequestMetrics": Boolean,
  "LogBeginRule": String   
}

LogConfig properties

Property

Type

Required

Editable

Description

Constraint

Project

String

No

Yes

The LogHub project name.

None.

Logstore

String

No

Yes

The LogHub Logstore name.

None.

EnableRequestMetrics

Boolean

No

Yes

Specifies whether to enable request monitoring.

Valid values:

  • true

  • false

LogBeginRule

String

No

Yes

The log segmentation rule.

None.

VpcConfig syntax

"VpcConfig": {
  "SecurityGroupId": String,
  "VSwitchIds": List,
  "VpcId": String,
  "ZoneId": 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 IDs of the vSwitches.

None.

VpcId

String

Yes

Yes

The ID of the VPC.

None.

ZoneId

String

No

Yes

The ID of the zone.

None.

NasConfig syntax

"NasConfig": {
  "MountPoints": List,
  "UserId": Integer,
  "GroupId": Integer
}

NasConfig properties

Property

Type

Required

Editable

Description

Constraint

MountPoints

List

Yes

Yes

The mount targets.

MountPoints properties.

UserId

Integer

Yes

Yes

The ID of the user.

Valid values: -1 to 65534.

GroupId

Integer

Yes

Yes

The ID of the 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 Managed Service for OpenTelemetry.

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 key must be 1 to 128 characters in length, and cannot contain http:// or https://. It cannot start with aliyun or acs:.

Value

String

No

No

The value of the tag.

The value can be up to 128 characters in length, and cannot contain http:// or https://. It cannot start with aliyun or acs:.

OssMountConfig syntax

"OssMountConfig": {
  "MountPoints": List
}

OssMountConfig property

Property

Type

Required

Editable

Description

Constraint

MountPoints

List

Yes

Yes

The OSS mount target configurations.

MountPoints properties.

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.

Return values

Fn::GetAtt

  • ServiceId: the unique ID of the service.

  • ServiceName: the name of the service.

  • Tags: the tags.

  • Role: the RAM role.

  • LogProject: the log project.

  • Logstore: the Logstore.

  • InternetAccess: whether functions can access the Internet.

  • VpcId: the ID of the VPC.

Examples

YAML format

ROSTemplateFormatVersion: '2015-09-01'
Description: Test FC
Parameters: {}
Resources:
  Service:
    Type: ALIYUN::FC::Service
    Properties:
      ServiceName: mytest
Outputs: {}                 

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": "Test FC",
  "Parameters": {
  },
  "Resources": {
    "Service": {
      "Type": "ALIYUN::FC::Service",
      "Properties": {
        "ServiceName": "mytest"
      }
    }
  },
  "Outputs": {
  }
}