Amazon cloudformation 当存储类型为io1时在cloudformation中使用Iops属性,当存储类型为gp2时不使用Iops属性
我创建了一个模板来使用Cloudformation配置RDS。创建RDS时,我们有两个选项io1和gp2。使用gp2时,我们不需要定义iops,但使用io1时,我们需要定义iops。 我可以使用io1,但gp2显示错误:- 遇到属性Iops的非数字值 我的模板片段Amazon cloudformation 当存储类型为io1时在cloudformation中使用Iops属性,当存储类型为gp2时不使用Iops属性,amazon-cloudformation,rds,Amazon Cloudformation,Rds,我创建了一个模板来使用Cloudformation配置RDS。创建RDS时,我们有两个选项io1和gp2。使用gp2时,我们不需要定义iops,但使用io1时,我们需要定义iops。 我可以使用io1,但gp2显示错误:- 遇到属性Iops的非数字值 我的模板片段 StorageType: Description: choose the storage type gp2 for 'General purpose SSD' & io1 for 'IOPS SSD'.
StorageType:
Description: choose the storage type gp2 for 'General purpose SSD' & io1 for 'IOPS SSD'.
Default: "gp2"
Type: String
AllowedValues: ["gp2","io1"]
Conditions:
iops: !Equals [!Ref StorageType, "io1"]
gp2: !Equals [!Ref StorageType, "gp2"]
提前感谢正确的语法是:
Iops: !If [iops, !Ref iops, !Ref "AWS::NoValue"]
文件:
Iops: !If [iops, !Ref iops, !Ref "AWS::NoValue"]