All Products
Search
Document Center

Resource Orchestration Service:Fn::And

Last Updated:Jun 17, 2026

Fn::And is the AND operator that takes at least two conditions. It returns true if all conditions evaluate to true, and false if any condition evaluates to false.

Declaration

  • JSON

    {
      "Fn::And": [
        "condition1",
        "condition2",
        ...
      ]
    }
  • YAML

    • Syntax for the full function name:

      Fn::And:
        - condition1
        - condition2
        - ...
    • Syntax for the short form:

      !And [condition1, condition2, ...]

Parameters

condition: the condition to evaluate.

Return value

true or false.

Examples

Fn::And can define conditions only in the Conditions or Rules section.

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  EnvType:
    Default: pre
    Type: String
Conditions:
  TestEqualsCond:
    !Equals
      - prod
      - !Ref EnvType
  TestAndCond:
    !And
      - TestEqualsCond
      - !Equals
          - pre
          - !Ref EnvType
{
  "Parameters": {
    "EnvType": {
      "Default": "pre",
      "Type": "String"
    }
  },
  "Conditions": {
    "TestEqualsCond": {
      "Fn::Equals": [
        "prod",
        {"Ref": "EnvType"}
      ]
    },
    "TestAndCond": {
      "Fn::And": [
        "TestEqualsCond",
        {
          "Fn::Equals": [
            "pre",
            {"Ref": "EnvType"}
          ]
        }
      ]
    }
  }
}

Supported functions