All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::SLB::Rule

Last Updated:May 06, 2023

ALIYUN::SLB::Rule is used to add forwarding rules to an HTTP or HTTPS listener.

Syntax

{
  "Type": "ALIYUN::SLB::Rule",
  "Properties": {
    "ListenerPort": Integer,
    "RuleList": List,
    "LoadBalancerId": String,
    "ListenerProtocol": String
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

ListenerPort

Integer

Yes

No

The frontend listening port that is used by the Server Load Balancer (SLB) instance.

Valid values: 1 to 65535.

RuleList

List

Yes

No

The forwarding rules that you want to add.

You can add up to 10 forwarding rules in a request.

Each forwarding rule contains the Domain and URL properties:

  • RuleName

  • Domain

  • Url

  • VServerGroupId

You must specify at least one of Domain and URL.

Note

The combined value of Domain and URL must be unique in a listener.

LoadBalancerId

String

Yes

No

The ID of the SLB instance.

None.

ListenerProtocol

String

No

No

The frontend protocol that is used by the SLB instance.

None.

RuleList syntax

"RuleList": [
  {
    "Url": String,
    "Domain": String,
    "VServerGroupId": String,
    "RuleName": String
  }
]

RuleList properties

Property

Type

Required

Editable

Description

Constraint

Url

String

No

No

The path that is specified in the forwarding rule.

  • The path must be 2 to 80 characters in length.

  • The path must start with a forward slash (/) and can contain letters, digits, and the following special characters:

    - / . % ? # &

Domain

String

No

No

The request domain name that is associated with the forwarding rule.

None.

VServerGroupId

String

Yes

No

The ID of the vServer group that is associated with the forwarding rule.

None.

RuleName

String

Yes

No

The name of the forwarding rule.

The name must be 1 to 40 characters in length and can contain letters, digits, and the following special characters:

- / . _

Forwarding rule names must be unique within a listener.

Return values

Fn::GetAtt

Rules: details of the forwarding rules.

Examples

YAML format

ROSTemplateFormatVersion: '2015-09-01'
Resources:
  Rule:
    Type: ALIYUN::SLB::Rule
    Properties:
      ListenerPort:
        Ref: ListenerPort
      RuleList:
        Fn::Split:
          - ','
          - Ref: RuleList
          - Ref: RuleList
      LoadBalancerId:
        Ref: LoadBalancerId
Parameters:
  ListenerPort:
    Type: Number
    Description: |-
      The front-end HTTPS listener port of the Server Load Balancer instance. Valid value:
      1-65535
    MaxValue: 65535
    MinValue: 1
  RuleList:
    MinLength: 1
    Type: CommaDelimitedList
    Description: The forwarding rules to add.
    MaxLength: 10
  LoadBalancerId:
    Type: String
    Description: The ID of Server Load Balancer instance.
Outputs:
  Rules:
    Description: A list of forwarding rules. Each element of rules contains "RuleId".
    Value:
      Fn::GetAtt:
        - Rule
        - Rules

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Resources": {
    "Rule": {
      "Type": "ALIYUN::SLB::Rule",
      "Properties": {
        "ListenerPort": {
          "Ref": "ListenerPort"
        },
        "RuleList": {
          "Fn::Split": [",", {
            "Ref": "RuleList"
          }, {
            "Ref": "RuleList"
          }]
        },
        "LoadBalancerId": {
          "Ref": "LoadBalancerId"
        }
      }
    }
  },
  "Parameters": {
    "ListenerPort": {
      "Type": "Number",
      "Description": "The front-end HTTPS listener port of the Server Load Balancer instance. Valid value:\n1-65535",
      "MaxValue": 65535,
      "MinValue": 1
    },
    "RuleList": {
      "MinLength": 1,
      "Type": "CommaDelimitedList",
      "Description": "The forwarding rules to add.",
      "MaxLength": 10
    },
    "LoadBalancerId": {
      "Type": "String",
      "Description": "The ID of Server Load Balancer instance."
    }
  },
  "Outputs": {
    "Rules": {
      "Description": "A list of forwarding rules. Each element of rules contains \"RuleId\".",
      "Value": {
        "Fn::GetAtt": ["Rule", "Rules"]
      }
    }
  }
}