Split

To split a string into a list of string values so that you can select an element from the resulting string list, use the Fn::Split intrinsic function. Specify the location of splits with a delimiter, such as , (a comma). After you split a string, use the Fn::Select function to pick a specific element.

The split method is the CloudFormation Fn::Split equivalent.

Example Snippet

resource("Instance", "AWS::EC2::Instance",
  InstanceType: ref("InstanceType"),
  ImageId: "ami-0de53d8956e8dcf80",
  SecurityGroupIds: split(",", ref("SecurityGroups"))
)

Example Output

Resources:
  Instance:
    Type: AWS::EC2::Instance
    Properties:
      InstanceType:
        Ref: InstanceType
      ImageId: ami-0de53d8956e8dcf80
      SecurityGroupIds:
        Fn::Split:
        - ","
        - Ref: SecurityGroups

Back to Intrinsic Functions List.