ALIYUN::VPC::DhcpOptionsSet类型用于创建动态主机配置协议DHCP(Dynamic Host Configuration Protocol)选项集。

语法

{
  "Type": "ALIYUN::VPC::DhcpOptionsSet",
  "Properties": {
    "DomainName": String,
    "DhcpOptionsSetName": String,
    "DhcpOptionsSetDescription": String,
    "DomainNameServers": List
  }
}

属性

属性名称 类型 必须 允许更新 描述 约束
DomainName String 主机名后缀 取值示例:example.com。

DHCP选项集关联VPC后,会自动将主机名后缀同步给VPC中的ECS实例。

DhcpOptionsSetName String DHCP选项集的名称 长度为2~128个字符,以英文字母或汉字开头,可包含数字、下划线(_)和短划线(-)。
DhcpOptionsSetDescription String DHCP选项集的描述 长度为2~256个字符,不能以http://https://开头。
DomainNameServers List DNS服务器IP地址 最多指定4个DNS服务器IP地址。
说明 未指定任何DNS服务器IP地址时,ECS实例默认使用阿里云提供的DNS服务器IP地址(100.100.2.136和100.100.2.138)。

返回值

Fn::GetAtt

DhcpOptionsSetId:创建成功的DHCP选项集的ID。

示例

JSON格式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "DomainName": {
      "Type": "String",
      "Description": "The root domain, for example, example.com.\nAfter a DHCP options set is associated with a Virtual Private Cloud (VPC) network, the root domain in the DHCP options set is automatically synchronized to the ECS instances in the VPC network.",
      "Default": "example.com"
    },
    "DhcpOptionsSetName": {
      "Type": "String",
      "Description": "The name of the DHCP options set.\nThe name must be 2 to 128 characters in length and can contain letters, Chinese characters, digits, underscores (_), and hyphens (-). It must start with a letter or a Chinese character.",
      "Default": "test"
    },
    "DhcpOptionsSetDescription": {
      "Type": "String",
      "Description": "The description of the DHCP options set.\nThe description must be 2 to 256 characters in length and cannot start with http:// or https://.",
      "Default": "test"
    },
    "DomainNameServers": {
      "Type": "Json",
      "Description": "The DNS server IP addresses. Note Before you specify any DNS server IP address, all ECS instances in the associated VPC network use the IP addresses of the Alibaba Cloud DNS servers, which are 100.100.2.136 and 100.100.2.138.",
      "Default": [
        "100.100.2.136",
        "100.100.2.138"
      ]
    }
  },
  "Resources": {
    "DhcpOptionsSet": {
      "Type": "ALIYUN::VPC::DhcpOptionsSet",
      "Properties": {
        "DomainName": {
          "Ref": "DomainName"
        },
        "DhcpOptionsSetName": {
          "Ref": "DhcpOptionsSetName"
        },
        "DhcpOptionsSetDescription": {
          "Ref": "DhcpOptionsSetDescription"
        },
        "DomainNameServers": {
          "Ref": "DomainNameServers"
        }
      }
    }
  },
  "Outputs": {
    "DhcpOptionsSetId": {
      "Description": "The ID of the DHCP options set that is created.",
      "Value": {
        "Fn::GetAtt": [
          "DhcpOptionsSet",
          "DhcpOptionsSetId"
        ]
      }
    }
  }
}

YAML格式

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  DomainName:
    Type: String
    Description: |-
      The root domain, for example, example.com.
      After a DHCP options set is associated with a Virtual Private Cloud (VPC) network, the root domain in the DHCP options set is automatically synchronized to the ECS instances in the VPC network.
    Default: example.com
  DhcpOptionsSetName:
    Type: String
    Description: |-
      The name of the DHCP options set.
      The name must be 2 to 128 characters in length and can contain letters, Chinese characters, digits, underscores (_), and hyphens (-). It must start with a letter or a Chinese character.
    Default: test
  DhcpOptionsSetDescription:
    Type: String
    Description: |-
      The description of the DHCP options set.
      The description must be 2 to 256 characters in length and cannot start with http:// or https://.
    Default: test
  DomainNameServers:
    Type: Json
    Description: The DNS server IP addresses. Note Before you specify any DNS server
      IP address, all ECS instances in the associated VPC network use the IP addresses
      of the Alibaba Cloud DNS servers, which are 100.100.2.136 and 100.100.2.138.
    Default:
    - 100.100.2.136
    - 100.100.2.138
Resources:
  DhcpOptionsSet:
    Type: ALIYUN::VPC::DhcpOptionsSet
    Properties:
      DomainName:
        Ref: DomainName
      DhcpOptionsSetName:
        Ref: DhcpOptionsSetName
      DhcpOptionsSetDescription:
        Ref: DhcpOptionsSetDescription
      DomainNameServers:
        Ref: DomainNameServers
Outputs:
  DhcpOptionsSetId:
    Description: The ID of the DHCP options set that is created.
    Value:
      Fn::GetAtt:
      - DhcpOptionsSet
      - DhcpOptionsSetId