Cidr

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

Example Snippet

resource("ExampleSubnet", "AWS::EC2::Subnet",
  assign_ipv6_address_on_creation: "true",
  cidr_block: select("0", cidr(get_att("ExampleVpc.CidrBlock"), "1", "8")),
  vpc_id: 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.

Pro tip: Use the <- and -> arrow keys to move back and forward.

Edit this page

See a typo or an error? You can improve this page. This website is available on GitHub and contributions are encouraged and welcomed. We love pull requests from you!