All Products
Search
Document Center

Resource Orchestration Service:Function index

Last Updated:Mar 28, 2024

Resource Orchestration Service (ROS) provides various built-in functions to help you manage stacks. You can use built-in functions in the Resources and Outputs sections. This topic describes the built-in functions that are supported by ROS.

Considerations

If you use YAML to define a function in the short syntax form and specify the parameter value of the function by using another function, you must define at least one of the functions in the full syntax form. Otherwise, the functions are invalid.

  • Functions in the following syntax form are invalid:

    !Base64Encode !Sub string
    !Base64Encode !Ref logical_ID
  • Functions in the following syntax forms are valid:

    !Base64Encode
     "Fn::Sub": string
    
    Fn::Base64Encode:
     !Sub string

Supported functions

Function

Description

Fn::Base64Encode

Returns the Base64-encoded format of a string.

Fn::Base64Decode

Returns a string decoded from a Base64-encoded string.

Fn::Str

Returns the string form of a number.

Fn::Indent

Adjusts the indentation format of a string.

Fn::FindInMap

Returns the value that corresponds to keys in a two-level mapping declared in the Mappings section.

Fn::GetAtt

Returns the property value of a resource from a template.

Fn::Join

Combines a set of strings into a single string that is separated by a delimiter.

Fn::Sub

Substitutes variables in a string with values that you specify.

Fn::Select

Returns data elements from a list or a dictionary based on an index.

Ref

References the value of a parameter or resource.

Fn::GetAZs

Returns a list of zones that belong to a region.

Fn::Replace

Replaces a substring in a string with another substring.

Fn::Split

Splits a string into multiple values by using a delimiter.

Fn::Equals

Compares two values to check whether they are equal. If the two values are equal, true is returned. If the two values are not equal, false is returned.

Fn::And

Represents the AND operator and must contain at least two conditions. If all the specified conditions are evaluated to true, true is returned. If a condition is evaluated to false, false is returned.

Fn::Or

Represents the OR operator and must contain at least two conditions. If a condition is evaluated to true, true is returned. If all the specified conditions are evaluated to false, false is returned.

Fn::Not

Represents the NOT operator. If a condition is evaluated to false, true is returned. If a condition is evaluated to true, false is returned.

Fn::Index

Queries the index of an element in a list.

Fn::If

Returns one of two possible values. The function returns one value if a specified condition is evaluated to true, and returns the other value if not. The property values in the Resources and Outputs sections of templates support the built-in function Fn::If. You can use the pseudo parameter ALIYUN::NoValue as the return value to delete the property.

Fn::Length

Returns the number of elements in an object.

Fn::ListMerge

Merges multiple lists into one list.

Fn::GetJsonValue

Resolves a JSON string and queries the value of a key from the first layer.

Fn::MergeMapToList

Merges multiple mappings into a new mapping list.

Fn::Avg

Returns the average value of a set of numbers.

Fn::SelectMapList

Returns values from a list of maps.

Fn::Add

Calculates the sum of parameters.

Fn::Calculate

Returns the calculation result of an expression of the String type.

Fn::Max

Returns the largest number from a list of numbers.

Fn::Min

Returns the smallest number from a list of numbers.

Fn::GetStackOutput

Queries the output of a stack.

Fn::Jq

Supports jq features. For more information about jq features, see jq Manual (development version).

Fn::FormatTime

Returns a formatted value of the current time.

Fn::MarketplaceImage

Returns the default ID of an Alibaba Cloud Marketplace image based on the product code of the image.

Fn::Any

Checks the values in an array. If one of the values is evaluated to true, true is returned. If none of the values is evaluated to true, false is returned.

Fn::Contains

Returns true if a specified value matches at least one member in a list, and returns false if not.

Fn::EachMemberIn

Returns true if each member in a list matches at least one member in another list, and returns false if not.

Fn::MatchPattern

Checks whether a value of the String type matches the condition in a regular expression. If the value matches the condition, true is returned. Otherwise, false is returned.