gpt4 book ai didi

amazon-web-services - 在 cloudformation 模板之间创建 Fn::GetAtt 引用

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

我正在创建自定义 cloudformation 模板,并且我了解您可以使用 Fn::GetAtt 功能使用您的输出将参数从其他模板调用到其他模板中。

目前我的 VPC 模板有,例如;

"ParentVPC" : {    
"Description" : "VPC ID",
"Value" : { "Ref" : "VPC" }
},
"DBSubnet01" : {
"Description" : "DB Subnet 01",
"Value" : {"Ref": "DBSubnet01"}
}

因此,从我的应用程序模板中,我想知道如何将它们作为参数调用。我努力了;

"ParentVPC" : {
"Type" : "AWS::EC2::VPC::Id",
"Description" : "VPC of Parent"
},
"DBSubnet01": {
"Description" : "Reference to VPC DBSubnet01",
"Type" : "List<AWS::EC2::Subnet::Id>",
"ConstraintDescription": "must be list of EC2 subnet ids"
}

欢迎提出任何建议

最佳答案

在定义 VPC 的模板中,创建如下输出值:

"Outputs" : {
"ParentVPC" : {
"Value" : {"Ref":"VPC"},
"Description" : "VPC ID"
},
...
}

然后,在使用 VPC 的模板中,创建如下参数:

"Parameters" : {
"ParentVPC" : {
"Type" : "AWS::EC2::VPC::Id",
},
...
}

从此模板创建堆栈时,在 VPC 定义堆栈上调用 describe-stack 以获取输出值,并将它们作为参数传递给 create-stack .

关于amazon-web-services - 在 cloudformation 模板之间创建 Fn::GetAtt 引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29704382/

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