All Products
Search
Document Center

Resource Orchestration Service:Fn::Cidr

Last Updated:Jun 22, 2026

Fn::Cidr creates an IP address range with a specific prefix length and returns an array of IPv4 CIDR blocks.

Declaration

  • JSON

    { 
      "Fn::Cidr": [ 
        "ipBlock", 
        "count", 
        "cidrBits" 
      ] 
    }
  • YAML

    • Syntax for the full function name:

      Fn::Cidr:
        - ipBlock
        - count
        - cidrBits
    • Syntax for the short form:

      !Cidr [ipBlock, count, cidrBits]

Parameters

  • ipBlock: the original CIDR block to be split into smaller CIDR blocks.

  • count: the number of IPv4 CIDR blocks to generate. Valid values: 1 to 256.

  • cidrBits: the number of subnet bits for the new CIDR block. For example, a value of "8" creates a CIDR block with a mask of "/24".

    Note

    The subnet bit is the inverse of the subnet mask. To calculate the required host bits for given subnet bits, subtract the subnet bits from 32 for IPv4.

Return value

An array of CIDR blocks.

Examples

  • This example creates 6 CIDR blocks with a subnet mask "/27" from a CIDR block with a mask of "/24".

    YAML

    !Cidr 
      - "192.168.0.0/24"
      - 6
      - 5

    JSON

    { 
      "Fn::Cidr": [ 
        "192.168.0.0/24", 
        6, 
        5 
      ] 
    }

    Return value: ['192.168.0.0/27', '192.168.0.32/27', '192.168.0.64/27', '192.168.0.96/27', '192.168.0.128/27', '192.168.0.160/27']