ALIYUN::ApiGateway::CustomDomain is used to bind a custom domain name and upload a Secure Sockets Layer (SSL) certificate to a specific API group.
The SSL certificate must match the custom domain name.
After the SSL certificate is bound, HTTPS-based API services become available.
Syntax
{
"Type": "ALIYUN::ApiGateway::CustomDomain",
"Properties": {
"CertificateBody": String,
"CertificateName": String,
"GroupId": String,
"CertificatePrivateKey": String,
"DomainName": String
}
}
Properties
Property | Type | Required | Editable | Description | Constraint |
DomainName | String | Yes | No | The custom domain name. | If a domain name fails to be bound, check the causes and bind the domain name again. For more information, see Bind a custom domain name to allow API calls. |
GroupId | String | Yes | No | The ID of the API group. | None. |
CertificateBody | String | No | Yes | The certificate content. | Certificate content is written as a single line and you can break the line by using the |
CertificateName | String | No | Yes | The name of the SSL certificate. | None. |
CertificatePrivateKey | String | No | Yes | The private key of the SSL certificate. | None. |
Return values
Fn::GetAtt
CertificateId: the certificate ID.
Examples
Change the values of masked parameters, such as DomainName, based on your business requirements.
YAML
format
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
GroupId:
Type: String
Description: the ID of the API group.
CertificateBody:
Type: String
CertificatePrivateKey:
Type: String
Resources:
CustomDomain:
Type: 'ALIYUN::ApiGateway::CustomDomain'
Properties:
GroupId:
Ref: GroupId
DomainName: ****.api.domain
CertificateName: demo_cert
CertificateBody:
Ref: CertificateBody
CertificatePrivateKey:
Ref: CertificatePrivateKey
JSON
format
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"GroupId": {
"Type": "String",
"Description": "the ID of the API group."
},
"CertificateBody": {
"Type": "String"
},
"CertificatePrivateKey": {
"Type": "String"
}
},
"Resources": {
"CustomDomain": {
"Type": "ALIYUN::ApiGateway::CustomDomain",
"Properties": {
"GroupId": {
"Ref": "GroupId"
},
"DomainName": "****.api.domain",
"CertificateName": "demo_cert",
"CertificateBody": {
"Ref": "CertificateBody"
},
"CertificatePrivateKey": {
"Ref": "CertificatePrivateKey"
}
}
}
}
}