全部产品
Search
文档中心

资源编排:ALIYUN::DDoSPro::Port

更新时间:Aug 12, 2024

ALIYUN::DDoSPro::Port类型用于创建一条DDoS高防端口转发规则。

语法

{
  "Type": "ALIYUN::DDoSPro::Port",
  "Properties": {
    "BackendPort": String,
    "InstanceId": String,
    "RealServers": List,
    "FrontendPort": String,
    "FrontendProtocol": String
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

FrontendProtocol

String

转发协议类型。

取值:

  • tcp:表示TCP协议。

  • udp:表示UDP协议。

InstanceId

String

端口转发规则所属的DDoS高防实例的ID。

RealServers

List

源站IP地址列表。

BackendPort

String

源站端口。

取值范围:0~65535

FrontendPort

String

转发端口。

取值范围:0~65535

返回值

Fn::GetAtt

FrontendPort:转发端口。

示例

YAML格式

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  BackendPort:
    Type: String
    Description:
      en: 'The port of the origin server. Valid values: 0 to 65535.'
    Required: false
  InstanceId:
    Type: String
    Description:
      en: The ID of the Anti-DDoS Pro or Anti-DDoS Premium instance to which the port forwarding rule belongs.
    Required: true
  RealServers:
    AssociationPropertyMetadata:
      Parameter:
        Type: String
        Description:
          en: The IP address of the origin server.
        Required: true
    AssociationProperty: List[Parameter]
    Type: Json
    Description:
      en: An array that consists of the IP addresses of origin servers.
    Required: true
  FrontendPort:
    Type: String
    Description:
      en: 'The forwarding port. Valid values: 0 to 65535.'
    Required: false
  FrontendProtocol:
    Type: String
    Description:
      en: |-
        The type of the protocol. Valid values: 
        tcp
        udp
    AllowedValues:
      - tcp
      - udp
    Required: true
Resources:
  ExtensionResource:
    Type: ALIYUN::DDoSPro::Port
    Properties:
      BackendPort:
        Ref: BackendPort
      InstanceId:
        Ref: InstanceId
      RealServers:
        Ref: RealServers
      FrontendPort:
        Ref: FrontendPort
      FrontendProtocol:
        Ref: FrontendProtocol
Outputs:
  FrontendPort:
    Description: The forwarding port.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - FrontendPort

JSON格式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "BackendPort": {
      "Type": "String",
      "Description": {
        "en": "The port of the origin server. Valid values: 0 to 65535."
      },
      "Required": false
    },
    "InstanceId": {
      "Type": "String",
      "Description": {
        "en": "The ID of the Anti-DDoS Pro or Anti-DDoS Premium instance to which the port forwarding rule belongs."
      },
      "Required": true
    },
    "RealServers": {
      "AssociationPropertyMetadata": {
        "Parameter": {
          "Type": "String",
          "Description": {
            "en": "The IP address of the origin server."
          },
          "Required": true
        }
      },
      "AssociationProperty": "List[Parameter]",
      "Type": "Json",
      "Description": {
        "en": "An array that consists of the IP addresses of origin servers."
      },
      "Required": true
    },
    "FrontendPort": {
      "Type": "String",
      "Description": {
        "en": "The forwarding port. Valid values: 0 to 65535."
      },
      "Required": false
    },
    "FrontendProtocol": {
      "Type": "String",
      "Description": {
        "en": "The type of the protocol. Valid values: \ntcp\nudp"
      },
      "AllowedValues": [
        "tcp",
        "udp"
      ],
      "Required": true
    }
  },
  "Resources": {
    "ExtensionResource": {
      "Type": "ALIYUN::DDoSPro::Port",
      "Properties": {
        "BackendPort": {
          "Ref": "BackendPort"
        },
        "InstanceId": {
          "Ref": "InstanceId"
        },
        "RealServers": {
          "Ref": "RealServers"
        },
        "FrontendPort": {
          "Ref": "FrontendPort"
        },
        "FrontendProtocol": {
          "Ref": "FrontendProtocol"
        }
      }
    }
  },
  "Outputs": {
    "FrontendPort": {
      "Description": "The forwarding port.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "FrontendPort"
        ]
      }
    }
  }
}