如何基于AWS Cloud-formation中的资源名称获取堆栈详细信息 [英] How to get the stack details based on resource name in AWS Cloud-formation
问题描述
有什么办法可以从创建的资源中找到堆栈名称吗?假设我有cft模板,该模板创建了堆栈A和资源B.然后由于需要,我必须为相同的资源B创建另一个堆栈C.
Is there any way I can find the stack name from the resource created? Let's say I have cft template which creates a stack A and Resource B. Then due to requirement, I have to create another stack C for the same resource B.
但是堆栈C的怪癖不允许我创建资源B,因为堆栈A已经被它锁定了.因此,我的目的是找到资源B拥有的较早的堆栈,并删除堆栈A.然后,使用CFT实现Stack B,然后创建资源B.
But the creae of stack C doesn't allow me to create Resource B, because Stack A already locked with it. So, my purpose is to find the earlier stack which owns for the resource B and delete the stack A. Then, Implement Stack B with CFT and then create the resource B.
我正在尝试使用boto3.
I'm trying to use boto3.
推荐答案
除了您定义的任何标签之外,AWS CloudFormation还会自动创建以下带有前缀aws的堆栈级标记:
In addition to any tags you define, AWS CloudFormation automatically creates the following stack-level tags with the prefix aws::
aws:cloudformation:logical-id
aws:cloudformation:logical-id
aws:cloudformation:stack-id
aws:cloudformation:stack-id
aws:cloudformation:stack-name
aws:cloudformation:stack-name
aws:前缀保留供AWS使用
The aws: prefix is reserved for AWS use
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html
这篇关于如何基于AWS Cloud-formation中的资源名称获取堆栈详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!