Troposhere to loop EC2 instance creation

296 Views Asked by At

I want to create variable number of EC2 instances within my cloudformation template (YAML). I am planning to create a stack for EC2 instance creation and loop the same. I read this is achievable using Troposphere. Can someone help me with a template or example?

1

There are 1 best solutions below

0
OllieB On

Write the below into a class you can reuse for each instance.

https://github.com/cloudtools/troposphere/blob/master/examples/EC2InstanceSample.py