ALIYUN::BastionHost::Host类型用于在堡垒机中创建需要运维的主机。

语法

{
  "Type": "ALIYUN::BastionHost::Host",
  "Properties": {
    "Comment": String,
    "ActiveAddressType": String,
    "HostPrivateAddress": String,
    "InstanceRegionId": String,
    "HostPublicAddress": String,
    "InstanceId": String,
    "OSType": String,
    "SourceInstanceId": String,
    "HostName": String,
    "Source": String
  }
}

属性

属性名称 类型 必须 允许更新 描述 约束
Comment String 指定主机的备注信息。 最多支持500个字符。
ActiveAddressType String 指定新创建主机的地址类型。 取值:
  • Public:公网地址。
  • Private:私网地址。
HostPrivateAddress String 指定新创建主机的私网地址。 可使用域名或IP地址。
说明 当ActiveAddressType参数取值为Private时,该参数为必填项。
InstanceRegionId String 指定新创建的ECS实例或专属集群主机所属区域ID。
HostPublicAddress String 指定新创建主机的公网地址。 可使用域名或IP地址。
说明 当ActiveAddressType取值为Public时,该参数为必填项。
InstanceId String 指定新创建主机所在堡垒机的实例ID。
说明 您可以通过调用DescribeInstances接口获取该参数。
OSType String 指定新创建主机的操作系统。 取值:
  • Linux
  • Windows
SourceInstanceId String 指定新创建的ECS实例ID或专属集群主机ID。
HostName String 指定新创建主机的名称。 最多支持128个字符。
Source String 指定新创建主机的来源。 取值:
  • Local:本地主机。
  • Ecs:ECS实例主机。
  • Rds:RDS专属集群主机。

返回值

Fn::GetAtt

HostId:新创建主机的ID。

示例

  • JSON格式

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "ActiveAddressType": {
          "Type": "String",
          "Description": "The endpoint type of the host that you want to create. Valid values:\nPublic: a public endpoint\nPrivate: an internal endpoint",
          "AllowedValues": [
            "Private",
            "Public"
          ]
        },
        "InstanceId": {
          "Type": "String",
          "Description": "The ID of the Bastionhost instance where you want to create the host.\nNote: You can call the DescribeInstances operation to query the ID of the Bastionhost instance."
        },
        "OSType": {
          "Type": "String",
          "Description": "The operating system of the host that you want to create. Valid values:\n- Linux\n- Windows",
          "AllowedValues": [
            "Linux",
            "Windows"
          ]
        },
        "HostName": {
          "Type": "String",
          "Description": "The name of the host that you want to create. The name can be up to 128 characters in length.",
          "MaxLength": 128
        },
        "Source": {
          "Type": "String",
          "Description": "The source of the host that you want to create. Valid values:\n- Local: an on-premises host\n- Ecs: an Elastic Compute Service (ECS) instance\n- Rds: a host in a dedicated cluster",
          "AllowedValues": [
            "Ecs",
            "Local",
            "Rds"
          ]
        }
      },
      "Resources": {
        "Host": {
          "Type": "ALIYUN::BastionHost::Host",
          "Properties": {
            "ActiveAddressType": {
              "Ref": "ActiveAddressType"
            },
            "InstanceId": {
              "Ref": "InstanceId"
            },
            "OSType": {
              "Ref": "OSType"
            },
            "HostName": {
              "Ref": "HostName"
            },
            "Source": {
              "Ref": "Source"
            }
          }
        }
      },
      "Outputs": {
        "HostId": {
          "Description": "The ID of the host that was created.",
          "Value": {
            "Fn::GetAtt": [
              "Host",
              "HostId"
            ]
          }
        }
      }
    }
  • YAML格式

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      ActiveAddressType:
        Type: String
        Description: |-
          The endpoint type of the host that you want to create. Valid values:
          Public: a public endpoint
          Private: an internal endpoint
        AllowedValues:
          - Private
          - Public
      InstanceId:
        Type: String
        Description: |-
          The ID of the Bastionhost instance where you want to create the host.
          Note: You can call the DescribeInstances operation to query the ID of the Bastionhost instance.
      OSType:
        Type: String
        Description: |-
          The operating system of the host that you want to create. Valid values:
          - Linux
          - Windows
        AllowedValues:
          - Linux
          - Windows
      HostName:
        Type: String
        Description: The name of the host that you want to create. The name can be up to 128 characters in length.
        MaxLength: 128
      Source:
        Type: String
        Description: |-
          The source of the host that you want to create. Valid values:
          - Local: an on-premises host
          - Ecs: an Elastic Compute Service (ECS) instance
          - Rds: a host in a dedicated cluster
        AllowedValues:
          - Ecs
          - Local
          - Rds
    Resources:
      Host:
        Type: ALIYUN::BastionHost::Host
        Properties:
          ActiveAddressType:
            Ref: ActiveAddressType
          InstanceId:
            Ref: InstanceId
          OSType:
            Ref: OSType
          HostName:
            Ref: HostName
          Source:
            Ref: Source
    Outputs:
      HostId:
        Description: The ID of the host that was created.
        Value:
          Fn::GetAtt:
            - Host
            - HostId