ALIYUN::SLB::Rule is used to add forwarding rules for a specified HTTP or HTTPS listener.

Syntax

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

Properties

Property Type Required Editable Description Constraint
ListenerPort Integer Yes No The frontend listener port number used by the SLB instance. Valid values: 1 to 65535.
RuleList List Yes No The list of forwarding rules to be added.

A maximum of 10 forwarding rules can be added at a time.

Each forwarding rule contains the following parameters:
  • RuleName
  • Domain
  • Url
  • VServerGroupId

You must specify at least one of the Domain and URL parameters.

The value combination specified by the Domain and URL parameters must be unique in a listener.

LoadBalancerId String Yes No The ID of 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 request URL.
  • The URL must be 2 to 80 characters in length.
  • It must start with a forward slash (/) and can contain letters, digits, and the following special characters:

    - / . % ? # &

Domain String No No The request domain name associated with the forwarding rule. None.
VServerGroupId String Yes No The ID of the destination VServer group specified in 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 each listener.

Response parameters

Fn::GetAtt

Rules: the list of forwarding rules.

Examples

{
  "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"]
      }
    }
  }
}