Cidr

The intrinsic function Fn::Cidr returns an array of CIDR address blocks. The number of CIDR blocks returned is dependent on the count parameter.

The cidr method is the CloudFormation Fn::Cidr equivalent.

Example Snippet

resource("ExampleSubnet", "AWS::EC2::Subnet",
  AssignIpv6AddressOnCreation: "true",
  CidrBlock: select("0", cidr(get_att("ExampleVpc.CidrBlock"), "1", "8")),
  VpcId: ref("ExampleVpc")}
)

Example Output

Resources:
  ExampleSubnet:
    Type: AWS::EC2::Subnet
    Properties:
      AssignIpv6AddressOnCreation: 'true'
      CidrBlock:
        Fn::Select:
        - '0'
        - Fn::Cidr:
          - Fn::GetAtt:
            - ExampleVpc
            - CidrBlock
          - '1'
          - '8'
      VpcId:
        Ref: ExampleVpc

Back to Intrinsic Functions List.