我有一个参数:
ClusterSubnets:
Description: Subnets where cluster will reside.
Typically private. Use mutiples, each in a different AZ for HA.
ConstraintDescription: comma separated list of valid Subnet IDs
Type: List<AWS::EC2::Subnet::Id>
我正在尝试输出:
ClusterSubnets:
Description: Subnets used by cluster
Value: !Ref ClusterSubnets
Export:
Name: !Sub "${AWS::StackName}-ClusterSubnets"
但我收到此错误:模板格式错误:每个Outputs成员的Value字段必须求值为String。
如何导出列表?
答案 0 :(得分:5)
您需要将列表的元素连接成一个字符串。尝试这样的事情:
ClusterSubnets:
Description: Subnets used by cluster
Value: !Join
- ','
- !Ref ClusterSubnets
Export:
Name: !Sub "${AWS::StackName}-ClusterSubnets"
以下是相关的AWS documentation。