Reputation: 93
I want to create multiple volumes via single Cloudformation template, While searching for the loops in cloudformation i found its not available.
Does anyone know how to accomplish this in CLoudformation.
This working template
to create Single volume.
Working template:
---
Description: "Create FSx for ONTAP Filesystem"
Resources:
AWSDemoVolume:
Type: "AWS::FSx::Volume"
Properties:
Name: AWSBackupDemovol001
OntapConfiguration:
JunctionPath: /AWSBackupDemovol001
SizeInMegabytes: 150
StorageEfficiencyEnabled: true
StorageVirtualMachineId: "svm-04c2e2830ff42097e"
TieringPolicy:
CoolingPeriod: 2
Name: AUTO
VolumeType: "ONTAP"
Tags:
- Key: "Bacup_Tag"
Value: "backup"
- Key: "Created_By"
Value: "Cloud Micron"
...
While looking at various suggestion i tried Bleow but not working.
---
Description: >
This template Deploys Multiple FsxN Volume from an existing Storage Virtual Machines(SVM).
Resources:
AWSDemoVolume:
Type: "AWS::FSx::Volume"
Properties:
Name: AWSDemovol001"%d"
OntapConfiguration:
JunctionPath: /AWSDemovol00"%d"
SizeInMegabytes: 150
StorageEfficiencyEnabled: true
StorageVirtualMachineId: "svm-08c5e3580ff41023e"
Count: 3
VolumeType: "ONTAP"
Tags:
- Key: "Bacup_Tag"
Value: "backup"
- Key: "Created_By"
Value: "Cloud Micron"
...
I want to create 3 more volumes names like AWSDemovol001 AWSDemovol002 and AWSDemovol003
.
please suggest.
Upvotes: 0
Views: 504
Reputation: 239005
There are no loops in CloudFormation. The only way to achieve what you want is through macros or custom resources.
So you have to develop your own macro or a custom resource in the form of a lambda function to perform the iterative creation of multiple volumes.
Upvotes: 1