gpt4 book ai didi

amazon-web-services - 将 ImportValue 导入 CFN 参数默认值的 YAML 语法

转载 作者:行者123 更新时间:2023-12-03 07:14:01 24 4
gpt4 key购买 nike

我正在努力使用 YAML 语法将另一个 CFN 堆栈导出的值导入到新堆栈中参数的默认值中。

我现在拥有的是:

Parameters:
DBEndpoint:
Description: Hostname endpoint for RDS Database
Type: String
Default: Fn::ImportValue: 'db-endpoint'

其中 db-endpoint 是以下 YAML 模板片段导出的值:

Outputs:
dbhost:
Description: "RDS Endpoint Address"
Value: !GetAtt DB.Endpoint.Address
Export:
Name: db-endpoint

导出工作正常,但在尝试使用 ImportValue 行加载模板时出现解析错误(模板格式错误:YAML 格式不正确。) .


更新:

我想我现在已经正确解析了 YAML,但现在出现了一个新错误。

Parameters:
DBEndpoint:
Description: Hostname endpoint for RDS Database
Type: String
Default: !ImportValue 'db-endpoint'

我收到错误模板格式错误:每个默认成员都必须是字符串。

所以,看起来更接近,但仍然不起作用。

This answer意味着这甚至可能不可能......是这样吗?

最佳答案

!ImportValue 'db-endpoint' 不能参数中使用。它只能在模板的ResourcesOutputs 中使用。您必须“手动”(即在 CloudFormation 之外,例如通过包装器脚本)将 DBEndpoint 的默认值设置为 db-endpoint 的实际值。

关于amazon-web-services - 将 ImportValue 导入 CFN 参数默认值的 YAML 语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70099815/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com