Creates a custom domain name for a Function Compute service.
Syntax
{
"Type": "ALIYUN::Serverless::CustomDomain",
"Properties": {
"Protocol": String,
"RouteConfig": Map,
"CertConfig": Map,
"DomainName": String
}
}
Properties
| Property name | Type | Required | Update allowed | Description | Constraints |
| Protocol | String | Yes | Yes | The protocol type supported by the custom domain. | Valid values:
|
| RouteConfig | Map | Yes | Yes | The route table that maps paths to functions. |
For more information, see routeconfig. |
| CertConfig | Map | No | Yes | The HTTPS certificate configuration. | For more information, see CertConfig properties. |
| DomainName | String | No | No | The domain name. | If you do not specify this property, the logical ID of the resource is used as the domain name. |
CertConfig syntax
"CertConfig": {
"CertName": String,
"PrivateKey": String,
"Certificate": String
}
CertConfig properties
| Property name | Type | Required | Update allowed | Description | Constraints |
| CertName | String | Yes | Yes | The custom name of the certificate. | None |
| PrivateKey | String | Yes | Yes | The private key of the certificate. | Use \n as the line feed character. |
| Certificate | String | Yes | Yes | The content of the certificate. | Enter the value as a single line. Use \n to represent line feeds. |
Return values
Fn::GetAtt
- DomainName: The domain name.
- Domain: The protocol and the domain name.
Examples
JSON format
{
"ROSTemplateFormatVersion": "2015-09-01",
"Transform": "Aliyun::Serverless-2018-04-03",
"Parameters": {
"DomainName": {
"Type": "String"
}
},
"Resources": {
"CustomDomain": {
"Type": "Aliyun::Serverless::CustomDomain",
"Properties": {
"DomainName": {
"Ref": "DomainName"
},
"Protocol": "HTTP",
"RouteConfig": {
"Routes": {
"/*": {
"ServiceName": "MyService",
"FunctionName": "MyServiceMyFunction"
}
}
}
}
}
},
"Outputs": {
"DomainName": {
"Value": {
"Fn::GetAtt": [
"CustomDomain",
"DomainName"
]
}
},
"Domain": {
"Value": {
"Fn::GetAtt": [
"CustomDomain",
"Domain"
]
}
}
}
}
YAML format
ROSTemplateFormatVersion: '2015-09-01'
Transform: 'Aliyun::Serverless-2018-04-03'
Parameters:
DomainName:
Type: String
Resources:
CustomDomain:
Type: 'Aliyun::Serverless::CustomDomain'
Properties:
DomainName:
Ref: DomainName
Protocol: HTTP
RouteConfig:
Routes:
/*:
ServiceName: MyService
FunctionName: MyServiceMyFunction
Outputs:
DomainName:
Value:
'Fn::GetAtt':
- CustomDomain
- DomainName
Domain:
Value:
'Fn::GetAtt':
- CustomDomain
- Domain
该文章对您有帮助吗?