我想通过一个Cloudformation模板创建多个卷,在Cloudformation中搜索循环时,我发现它不可用。
有人知道如何在CLoudforming中实现这一点吗。
此工作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"
...
在考虑各种建议的同时,我尝试了Blow,但没有成功。
---
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"
...
我想再创建3个卷名,如AWSDemovol001 AWSDemovol002 and AWSDemovol003
。
请提出建议。
CloudFormation中没有循环。实现所需功能的唯一方法是通过宏或自定义资源。
因此,您必须以lambda函数的形式开发自己的宏或自定义资源,以执行多个卷的迭代创建。