ALIYUN::APIG::Domain

更新时间:
复制 MD 格式

ALIYUN::APIG::Domain类型用于创建域名。

语法

{
  "Type": "ALIYUN::APIG::Domain",
  "Properties": {
    "DomainName": String,
    "GatewayType": String,
    "Protocol": String,
    "TlsMax": String,
    "CertIdentifier": String,
    "ResourceGroupId": String,
    "TlsCipherSuitesConfig": Map,
    "ForceHttps": Boolean,
    "TlsMin": String,
    "Http2Option": String
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

DomainName

String

是

否

域名。

无。

Protocol

String

是

是

域名支持的协议类型。

取值:

  • HTTP:仅支持 HTTP 协议。

  • HTTPS:仅支持 HTTPS 协议。

TlsMax

String

否

是

TLS 协议最大版本。

最大支持 TLS 1.3。

CertIdentifier

String

否

是

证书标识。

无

GatewayType

String

否

否

网关类型。

取值:

  • AI :

    AI 网关

  • API :

    云原生 API 网关

ResourceGroupId

String

否

是

资源组 ID。

无

TlsCipherSuitesConfig

Map

否

是

加密套件配置。

更多信息,请参考TlsCipherSuitesConfig属性。

ForceHttps

Boolean

否

是

设置 HTTPS 协议类型。

是否开启强制 HTTPS 跳转。

TlsMin

String

否

是

TLS 协议最小版本。

最小支持 TLS 1.0

Http2Option

String

否

是

http2 设置。

取值:

  • GlobalConfig:GlobalConfig。

  • Close:Close。

  • Open:Open。

TlsCipherSuitesConfig语法

"TlsCipherSuitesConfig": {
  "ConfigType": String,
  "TlsCipherSuite": List
}

TlsCipherSuitesConfig属性

属性名称

类型

必须

允许更新

描述

约束

ConfigType

String

否

是

配置类型。

无

TlsCipherSuite

List

否

是

加密套件配置。

更多信息,请参考TlsCipherSuite属性。

TlsCipherSuite语法

"TlsCipherSuite": [{
  "Name": String
}]

TlsCipherSuite属性

属性名称

类型

必须

允许更新

描述

约束

Name

String

否

是

加密套件名称。

无

返回值

Fn::GetAtt

  • DomainId:域名 id。

  • DomainName:域名。

  • Protocol:域名支持的协议类型。

  • CertIdentifier:证书标识。

  • Http2Option:http2 设置。

  • TlsMax:TLS 协议最大版本。

  • TlsMin:TLS 协议最小版本。

  • TlsCipherSuitesConfig:加密套件配置。

  • ResourceGroupId:资源组 ID。

  • ForceHttps:是否开启强制 HTTPS 跳转。

示例

场景 1 :创建HTTP协议的API网关域名

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 为云原生API网关创建一个HTTP协议的域名。
  en: Create an HTTP domain for Cloud Native API Gateway.
Parameters:
  DomainName:
    Type: String
    Label:
      zh-cn: 域名
      en: Domain Name
    Description:
      zh-cn: API网关的域名,例如api.example.com。
      en: The domain name for API Gateway, e.g. api.example.com.
    AllowedPattern: '^[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$'
    ConstraintDescription:
      zh-cn: 请输入合法的域名格式,例如api.example.com。
      en: Please enter a valid domain name format, e.g. api.example.com.
Resources:
  Domain:
    Type: ALIYUN::APIG::Domain
    Properties:
      DomainName:
        Ref: DomainName
      Protocol: HTTP
Outputs:
  DomainId:
    Label:
      zh-cn: 域名ID
      en: Domain ID
    Description:
      zh-cn: API网关域名的唯一标识。
      en: The unique identifier of the API Gateway domain.
    Value:
      Fn::GetAtt:
        - Domain
        - DomainId
  DomainName:
    Label:
      zh-cn: 域名
      en: Domain Name
    Value:
      Fn::GetAtt:
        - Domain
        - DomainName
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "为云原生API网关创建一个HTTP协议的域名。",
    "en": "Create an HTTP domain for Cloud Native API Gateway."
  },
  "Parameters": {
    "DomainName": {
      "Type": "String",
      "Label": {
        "zh-cn": "域名",
        "en": "Domain Name"
      },
      "Description": {
        "zh-cn": "API网关的域名,例如api.example.com。",
        "en": "The domain name for API Gateway, e.g. api.example.com."
      },
      "AllowedPattern": "^[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$",
      "ConstraintDescription": {
        "zh-cn": "请输入合法的域名格式,例如api.example.com。",
        "en": "Please enter a valid domain name format, e.g. api.example.com."
      }
    }
  },
  "Resources": {
    "Domain": {
      "Type": "ALIYUN::APIG::Domain",
      "Properties": {
        "DomainName": {
          "Ref": "DomainName"
        },
        "Protocol": "HTTP"
      }
    }
  },
  "Outputs": {
    "DomainId": {
      "Label": {
        "zh-cn": "域名ID",
        "en": "Domain ID"
      },
      "Description": {
        "zh-cn": "API网关域名的唯一标识。",
        "en": "The unique identifier of the API Gateway domain."
      },
      "Value": {
        "Fn::GetAtt": [
          "Domain",
          "DomainId"
        ]
      }
    },
    "DomainName": {
      "Label": {
        "zh-cn": "域名",
        "en": "Domain Name"
      },
      "Value": {
        "Fn::GetAtt": [
          "Domain",
          "DomainName"
        ]
      }
    }
  }
}

场景 2 :创建HTTPS协议的API网关域名,配置SSL证书并启用强制HTTPS跳转。

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 创建HTTPS域名,配置SSL证书并启用强制HTTPS跳转。
  en: Create an HTTPS domain with SSL certificate and force HTTPS redirect.
Parameters:
  DomainName:
    Type: String
    Label:
      zh-cn: 域名
      en: Domain Name
    Description:
      zh-cn: API网关的域名,例如api.example.com。需已完成域名备案和DNS解析。
      en: The domain name for API Gateway. DNS resolution and ICP filing must be completed.
    AllowedPattern: '^[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$'
  CertIdentifier:
    Type: String
    Label:
      zh-cn: SSL证书标识
      en: SSL Certificate Identifier
    Description:
      zh-cn: >-
        SSL证书的唯一标识,可在SSL证书服务控制台获取。
        证书需与域名匹配。
      en: >-
        The unique identifier of the SSL certificate, obtainable from the SSL Certificates Service console.
        The certificate must match the domain name.
  TlsMin:
    Type: String
    Label:
      zh-cn: TLS最低版本
      en: TLS Minimum Version
    Description:
      zh-cn: 允许的TLS协议最低版本。建议生产环境至少使用TLS 1.2。
      en: The minimum allowed TLS protocol version. TLS 1.2 or above is recommended for production.
    Default: TLS 1.2
    AllowedValues:
      - TLS 1.0
      - TLS 1.1
      - TLS 1.2
      - TLS 1.3
  TlsMax:
    Type: String
    Label:
      zh-cn: TLS最高版本
      en: TLS Maximum Version
    Description:
      zh-cn: 允许的TLS协议最高版本。
      en: The maximum allowed TLS protocol version.
    Default: TLS 1.3
    AllowedValues:
      - TLS 1.0
      - TLS 1.1
      - TLS 1.2
      - TLS 1.3
Resources:
  Domain:
    Type: ALIYUN::APIG::Domain
    Properties:
      DomainName:
        Ref: DomainName
      Protocol: HTTPS
      CertIdentifier:
        Ref: CertIdentifier
      TlsMin:
        Ref: TlsMin
      TlsMax:
        Ref: TlsMax
      ForceHttps: true
Outputs:
  DomainId:
    Label:
      zh-cn: 域名ID
      en: Domain ID
    Value:
      Fn::GetAtt:
        - Domain
        - DomainId
  DomainName:
    Label:
      zh-cn: 域名
      en: Domain Name
    Value:
      Fn::GetAtt:
        - Domain
        - DomainName
  Protocol:
    Label:
      zh-cn: 协议类型
      en: Protocol
    Value:
      Fn::GetAtt:
        - Domain
        - Protocol
  TlsMin:
    Label:
      zh-cn: TLS最低版本
      en: TLS Minimum Version
    Value:
      Fn::GetAtt:
        - Domain
        - TlsMin
  TlsMax:
    Label:
      zh-cn: TLS最高版本
      en: TLS Maximum Version
    Value:
      Fn::GetAtt:
        - Domain
        - TlsMax
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "创建HTTPS域名,配置SSL证书并启用强制HTTPS跳转。",
    "en": "Create an HTTPS domain with SSL certificate and force HTTPS redirect."
  },
  "Parameters": {
    "DomainName": {
      "Type": "String",
      "Label": {
        "zh-cn": "域名",
        "en": "Domain Name"
      },
      "Description": {
        "zh-cn": "API网关的域名,例如api.example.com。需已完成域名备案和DNS解析。",
        "en": "The domain name for API Gateway. DNS resolution and ICP filing must be completed."
      },
      "AllowedPattern": "^[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$"
    },
    "CertIdentifier": {
      "Type": "String",
      "Label": {
        "zh-cn": "SSL证书标识",
        "en": "SSL Certificate Identifier"
      },
      "Description": {
        "zh-cn": "SSL证书的唯一标识,可在SSL证书服务控制台获取。证书需与域名匹配。",
        "en": "The unique identifier of the SSL certificate, obtainable from the SSL Certificates Service console. The certificate must match the domain name."
      }
    },
    "TlsMin": {
      "Type": "String",
      "Label": {
        "zh-cn": "TLS最低版本",
        "en": "TLS Minimum Version"
      },
      "Description": {
        "zh-cn": "允许的TLS协议最低版本。建议生产环境至少使用TLS 1.2。",
        "en": "The minimum allowed TLS protocol version. TLS 1.2 or above is recommended for production."
      },
      "Default": "TLS 1.2",
      "AllowedValues": [
        "TLS 1.0",
        "TLS 1.1",
        "TLS 1.2",
        "TLS 1.3"
      ]
    },
    "TlsMax": {
      "Type": "String",
      "Label": {
        "zh-cn": "TLS最高版本",
        "en": "TLS Maximum Version"
      },
      "Description": {
        "zh-cn": "允许的TLS协议最高版本。",
        "en": "The maximum allowed TLS protocol version."
      },
      "Default": "TLS 1.3",
      "AllowedValues": [
        "TLS 1.0",
        "TLS 1.1",
        "TLS 1.2",
        "TLS 1.3"
      ]
    }
  },
  "Resources": {
    "Domain": {
      "Type": "ALIYUN::APIG::Domain",
      "Properties": {
        "DomainName": {
          "Ref": "DomainName"
        },
        "Protocol": "HTTPS",
        "CertIdentifier": {
          "Ref": "CertIdentifier"
        },
        "TlsMin": {
          "Ref": "TlsMin"
        },
        "TlsMax": {
          "Ref": "TlsMax"
        },
        "ForceHttps": true
      }
    }
  },
  "Outputs": {
    "DomainId": {
      "Label": {
        "zh-cn": "域名ID",
        "en": "Domain ID"
      },
      "Value": {
        "Fn::GetAtt": [
          "Domain",
          "DomainId"
        ]
      }
    },
    "DomainName": {
      "Label": {
        "zh-cn": "域名",
        "en": "Domain Name"
      },
      "Value": {
        "Fn::GetAtt": [
          "Domain",
          "DomainName"
        ]
      }
    },
    "Protocol": {
      "Label": {
        "zh-cn": "协议类型",
        "en": "Protocol"
      },
      "Value": {
        "Fn::GetAtt": [
          "Domain",
          "Protocol"
        ]
      }
    },
    "TlsMin": {
      "Label": {
        "zh-cn": "TLS最低版本",
        "en": "TLS Minimum Version"
      },
      "Value": {
        "Fn::GetAtt": [
          "Domain",
          "TlsMin"
        ]
      }
    },
    "TlsMax": {
      "Label": {
        "zh-cn": "TLS最高版本",
        "en": "TLS Maximum Version"
      },
      "Value": {
        "Fn::GetAtt": [
          "Domain",
          "TlsMax"
        ]
      }
    }
  }
}

场景 3 :创建HTTPS协议的API网关域名,配置自定义TLS加密套件、启用HTTP/2,实现全面的安全加固。

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 创建安全加固的HTTPS域名,配置自定义加密套件、启用HTTP/2并指定资源组。
  en: Create a security-hardened HTTPS domain with custom cipher suites, HTTP/2, and resource group.
Parameters:
  DomainName:
    Type: String
    Label:
      zh-cn: 域名
      en: Domain Name
    Description:
      zh-cn: API网关的域名,例如api.example.com。需已完成域名备案和DNS解析。
      en: The domain name for API Gateway. DNS resolution and ICP filing must be completed.
    AllowedPattern: '^[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$'
  CertIdentifier:
    Type: String
    Label:
      zh-cn: SSL证书标识
      en: SSL Certificate Identifier
    Description:
      zh-cn: >-
        SSL证书的唯一标识,可在SSL证书服务控制台获取。
        证书需与域名匹配。
      en: >-
        The unique identifier of the SSL certificate.
        The certificate must match the domain name.
  ResourceGroupId:
    Type: String
    Label:
      zh-cn: 资源组ID
      en: Resource Group ID
    Description:
      zh-cn: 域名所属的资源组ID,用于权限隔离和成本管理。
      en: The resource group ID for permission isolation and cost management.
    AssociationProperty: ALIYUN::ResourceManager::ResourceGroup
    Default: Null
  Http2Option:
    Type: String
    Label:
      zh-cn: HTTP/2设置
      en: HTTP/2 Option
    Description:
      zh-cn: >-
        HTTP/2协议设置。Open表示开启,Close表示关闭,
        GlobalConfig表示跟随全局配置。
      en: >-
        HTTP/2 protocol setting. Open to enable, Close to disable,
        GlobalConfig to follow global settings.
    Default: Open
    AllowedValues:
      - Open
      - Close
      - GlobalConfig
Resources:
  Domain:
    Type: ALIYUN::APIG::Domain
    Properties:
      DomainName:
        Ref: DomainName
      Protocol: HTTPS
      CertIdentifier:
        Ref: CertIdentifier
      ForceHttps: true
      Http2Option:
        Ref: Http2Option
      TlsMin: TLS 1.2
      TlsMax: TLS 1.3
      ResourceGroupId:
        Ref: ResourceGroupId
      TlsCipherSuitesConfig:
        ConfigType: custom
        TlsCipherSuite:
          - Name: TLS_AES_128_GCM_SHA256
          - Name: TLS_AES_256_GCM_SHA384
          - Name: TLS_CHACHA20_POLY1305_SHA256
          - Name: ECDHE-ECDSA-AES128-GCM-SHA256
          - Name: ECDHE-RSA-AES128-GCM-SHA256
          - Name: ECDHE-ECDSA-AES256-GCM-SHA384
          - Name: ECDHE-RSA-AES256-GCM-SHA384
Outputs:
  DomainId:
    Label:
      zh-cn: 域名ID
      en: Domain ID
    Value:
      Fn::GetAtt:
        - Domain
        - DomainId
  DomainName:
    Label:
      zh-cn: 域名
      en: Domain Name
    Value:
      Fn::GetAtt:
        - Domain
        - DomainName
  Protocol:
    Label:
      zh-cn: 协议类型
      en: Protocol
    Value:
      Fn::GetAtt:
        - Domain
        - Protocol
  Http2Option:
    Label:
      zh-cn: HTTP/2设置
      en: HTTP/2 Option
    Value:
      Fn::GetAtt:
        - Domain
        - Http2Option
  ForceHttps:
    Label:
      zh-cn: 是否强制HTTPS
      en: Force HTTPS
    Value:
      Fn::GetAtt:
        - Domain
        - ForceHttps
  TlsCipherSuitesConfig:
    Label:
      zh-cn: 加密套件配置
      en: TLS Cipher Suites Config
    Value:
      Fn::GetAtt:
        - Domain
        - TlsCipherSuitesConfig
  ResourceGroupId:
    Label:
      zh-cn: 资源组ID
      en: Resource Group ID
    Value:
      Fn::GetAtt:
        - Domain
        - ResourceGroupId
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "创建安全加固的HTTPS域名,配置自定义加密套件、启用HTTP/2并指定资源组。",
    "en": "Create a security-hardened HTTPS domain with custom cipher suites, HTTP/2, and resource group."
  },
  "Parameters": {
    "DomainName": {
      "Type": "String",
      "Label": {
        "zh-cn": "域名",
        "en": "Domain Name"
      },
      "Description": {
        "zh-cn": "API网关的域名,例如api.example.com。需已完成域名备案和DNS解析。",
        "en": "The domain name for API Gateway. DNS resolution and ICP filing must be completed."
      },
      "AllowedPattern": "^[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$"
    },
    "CertIdentifier": {
      "Type": "String",
      "Label": {
        "zh-cn": "SSL证书标识",
        "en": "SSL Certificate Identifier"
      },
      "Description": {
        "zh-cn": "SSL证书的唯一标识,可在SSL证书服务控制台获取。证书需与域名匹配。",
        "en": "The unique identifier of the SSL certificate. The certificate must match the domain name."
      }
    },
    "ResourceGroupId": {
      "Type": "String",
      "Label": {
        "zh-cn": "资源组ID",
        "en": "Resource Group ID"
      },
      "Description": {
        "zh-cn": "域名所属的资源组ID,用于权限隔离和成本管理。",
        "en": "The resource group ID for permission isolation and cost management."
      },
      "AssociationProperty": "ALIYUN::ResourceManager::ResourceGroup",
      "Default": null
    },
    "Http2Option": {
      "Type": "String",
      "Label": {
        "zh-cn": "HTTP/2设置",
        "en": "HTTP/2 Option"
      },
      "Description": {
        "zh-cn": "HTTP/2协议设置。Open表示开启,Close表示关闭,GlobalConfig表示跟随全局配置。",
        "en": "HTTP/2 protocol setting. Open to enable, Close to disable, GlobalConfig to follow global settings."
      },
      "Default": "Open",
      "AllowedValues": [
        "Open",
        "Close",
        "GlobalConfig"
      ]
    }
  },
  "Resources": {
    "Domain": {
      "Type": "ALIYUN::APIG::Domain",
      "Properties": {
        "DomainName": {
          "Ref": "DomainName"
        },
        "Protocol": "HTTPS",
        "CertIdentifier": {
          "Ref": "CertIdentifier"
        },
        "ForceHttps": true,
        "Http2Option": {
          "Ref": "Http2Option"
        },
        "TlsMin": "TLS 1.2",
        "TlsMax": "TLS 1.3",
        "ResourceGroupId": {
          "Ref": "ResourceGroupId"
        },
        "TlsCipherSuitesConfig": {
          "ConfigType": "custom",
          "TlsCipherSuite": [
            {
              "Name": "TLS_AES_128_GCM_SHA256"
            },
            {
              "Name": "TLS_AES_256_GCM_SHA384"
            },
            {
              "Name": "TLS_CHACHA20_POLY1305_SHA256"
            },
            {
              "Name": "ECDHE-ECDSA-AES128-GCM-SHA256"
            },
            {
              "Name": "ECDHE-RSA-AES128-GCM-SHA256"
            },
            {
              "Name": "ECDHE-ECDSA-AES256-GCM-SHA384"
            },
            {
              "Name": "ECDHE-RSA-AES256-GCM-SHA384"
            }
          ]
        }
      }
    }
  },
  "Outputs": {
    "DomainId": {
      "Label": {
        "zh-cn": "域名ID",
        "en": "Domain ID"
      },
      "Value": {
        "Fn::GetAtt": [
          "Domain",
          "DomainId"
        ]
      }
    },
    "DomainName": {
      "Label": {
        "zh-cn": "域名",
        "en": "Domain Name"
      },
      "Value": {
        "Fn::GetAtt": [
          "Domain",
          "DomainName"
        ]
      }
    },
    "Protocol": {
      "Label": {
        "zh-cn": "协议类型",
        "en": "Protocol"
      },
      "Value": {
        "Fn::GetAtt": [
          "Domain",
          "Protocol"
        ]
      }
    },
    "Http2Option": {
      "Label": {
        "zh-cn": "HTTP/2设置",
        "en": "HTTP/2 Option"
      },
      "Value": {
        "Fn::GetAtt": [
          "Domain",
          "Http2Option"
        ]
      }
    },
    "ForceHttps": {
      "Label": {
        "zh-cn": "是否强制HTTPS",
        "en": "Force HTTPS"
      },
      "Value": {
        "Fn::GetAtt": [
          "Domain",
          "ForceHttps"
        ]
      }
    },
    "TlsCipherSuitesConfig": {
      "Label": {
        "zh-cn": "加密套件配置",
        "en": "TLS Cipher Suites Config"
      },
      "Value": {
        "Fn::GetAtt": [
          "Domain",
          "TlsCipherSuitesConfig"
        ]
      }
    },
    "ResourceGroupId": {
      "Label": {
        "zh-cn": "资源组ID",
        "en": "Resource Group ID"
      },
      "Value": {
        "Fn::GetAtt": [
          "Domain",
          "ResourceGroupId"
        ]
      }
    }
  }
}