AWS Cloudformation nested Functions (Split, Select, Join, Ref)

+1 vote

I am trying to do the following:

  1. Get the CIDR block set by the user in the Parameters
  2. Split the CIDR by "." to get the individual numbers
  3. Join CIDR[0], CIDR[1], "4.0/24"

I have come up with the following funciton:

"CidrBlock": {
                "Join": [
                    ".",
                    [
                        {
                            "Select": [
                                "0",
                                {
                                    "Split": [
                                        ".",
                                        {
                                            "Ref": "2CIDR"
                                        }
                                    ]
                                }
                            ]
                        },
                        {
                            "Select": [
                                "1",
                                {
                                    "Split": [
                                        ".",
                                        {
                                            "Ref": "2CIDR"
                                        }
                                    ]
                                }
                            ]
                        },
                        "16.0/24"
                    ]
                ]
            },

But this fails with the following error:

Value of property CidrBlock must be of type String

I cannot find any examples of what I am trying to do on the internet.

Anyone has any idea what's wrong with the above function? Or can anyone suggest an alternative way to build the CIDR of each subnet using the CIDR of the VPC?

Sep 11, 2018 in AWS by bug_seeker
• 15,320 points
670 views

2 answers to this question.

+2 votes

Maybe what's wrong is that "Join" is not a function. "Fn::Join" is.

answered Sep 11, 2018 by Priyaj
• 56,200 points
+2 votes
"Join" is not a function. "Fn::Join" is.
answered May 16 by Nalin Kant Gupta
Totally agree with you. @Nalin

Related Questions In AWS

+3 votes
1 answer

aws cloudformation for atomic stack-update

When you perform a stack update, only ...READ MORE

answered Mar 27, 2018 in AWS by DareDev
• 6,810 points
61 views
0 votes
1 answer

How to create new stack using create-change-set in AWS Cloudformation

The type of change set operation. To ...READ MORE

answered Sep 18, 2018 in AWS by Priyaj
• 56,200 points
276 views
0 votes
1 answer

How to create a CloudFormation only AWS policy

The easiest way to achieve what you're ...READ MORE

answered Sep 26, 2018 in AWS by Priyaj
• 56,200 points
109 views
0 votes
1 answer
0 votes
1 answer
+1 vote
1 answer
0 votes
2 answers

Do AWS support SES in CloudFormation?

There is no straightforward approach to create ...READ MORE

answered 4 days ago in AWS by sri
248 views