All Products
Search
Document Center

Resource Orchestration Service:Fn::Avg

Last Updated:Jun 08, 2026

Fn::Avg returns the average of a set of numbers, rounded to a specified number of decimal places.

Declaration

Fn::Avg(ndigits, [number1, number2, ...])

  • JSON

    {
      "Fn::Avg": [
        ndigits,
        [
          number1,
          number2,
          ...
        ]
      ]
    }
  • YAML

    • Syntax for the full function name:

      Fn::Avg:
        - ndigits
        - - number1
          - number2
          - ...
    • Syntax for the short form:

      !Avg [ndigits, [number1, number2, ...]]

Parameters

  • ndigits: the number of decimal places in the return value. The value must be an integer.

  • [number1, number2, ...]: the values to average. Each element must be a number or a string that can be converted to a number.

Return value

The average of the input values, rounded to ndigits decimal places.

Examples

!Avg [1, [1, 2, 6]]
!Avg [1, [1, 2, 6.0]]

Integer and float inputs are treated identically, so both expressions return the same result.

Input

Return value

[1, 2, 6]

3.0

[1, 2, 6.0]

3.0

Supported functions

The [number1, number2, ...] array elements support the following functions: