# For loop in serverless.yml

**URL:** <https://forum.serverless.com/t/for-loop-in-serverless-yml/9018>\
**Category:** Serverless Framework\
**Tags:** api-gateway\
**Created:** [August 7, 2019, 6:44am UTC](https://forum.serverless.com/t/for-loop-in-serverless-yml/9018 "2019-08-07T06:44:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Swethamr402](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@Swethamr402](https://forum.serverless.com/u/Swethamr402)\
**Post date:** [August 7, 2019, 6:44am UTC](https://forum.serverless.com/t/for-loop-in-serverless-yml/9018/1 "2019-08-07T06:44:35Z")

</div>

HI Team,

We are having scenario to write a for loop inside yml file  
I tried using Fn:Split / !Split function, though its working but I am not able to separate the strings and join with other string.

- !Split [“,” , ${self:custom.connectInstanceId}]

Need to join like this

- “instance/${self:custom.connectInstanceId0}/routing-profile/\*”
- “instance/${self:custom.connectseondInstanceId1}/routing-profile/\*”

Can you please guide me on this.

Second query is  
I need to pass array of string and create an roles dynamically from dynamodb, so Is it possible to call node.js file from .yml file

Please guide me

Thanks  
Swetha
