Menu
AWS CloudFormation
User Guide (API Version 2010-05-15)

Fn::Join

The intrinsic function Fn::Join appends a set of values into a single value, separated by the specified delimiter. If a delimiter is the empty string, the set of values are concatenated with no delimiter.

Declaration

JSON

Copy
{ "Fn::Join" : [ "delimiter", [ comma-delimited list of values ] ] }

YAML

Syntax for the full function name:

Copy
Fn::Join: [ delimiter, [ comma-delimited list of values ] ]

Syntax for the short form:

Copy
!Join [ delimiter, [ comma-delimited list of values ] ]

Parameters

delimiter

The value you want to occur between fragments. The delimiter will occur between fragments only. It will not terminate the final value.

ListOfValues

The list of values you want combined.

Return Value

The combined string.

Examples

Join a Simple String Array

The following example returns: "a:b:c".

JSON

Copy
"Fn::Join" : [ ":", [ "a", "b", "c" ] ]

YAML

Copy
!Join [ ":", [ a, b, c ] ]

Join Using the Ref Function with Parameters

The following example uses Fn::Join to construct a string value. It uses the Ref function with the Partition parameter and the AWS::AccountId pseudo parameter.

JSON

Copy
{ "Fn::Join": [ "", [ "arn:", { "Ref": "Partition" }, ":s3:::elasticbeanstalk-*-", { "Ref": "AWS::AccountId" } ] ] }}

YAML

Copy
!Join - '' - - 'arn:' - !Ref Partition - ':s3:::elasticbeanstalk-*-' - !Ref 'AWS::AccountId'

Note

Also see the Fn::Sub function for similar functionality.

Supported Functions

For the Fn::Join delimiter, you cannot use any functions. You must specify a string value.

For the Fn::Join list of values, you can use the following functions:

  • Fn::Base64

  • Fn::FindInMap

  • Fn::GetAtt

  • Fn::GetAZs

  • Fn::If

  • Fn::ImportValue

  • Fn::Join

  • Fn::Split

  • Fn::Select

  • Fn::Sub

  • Ref