我有一个EC2实例,我想使用AWS CLI 知道它属于哪个云形成堆栈。
要在python中使用boto进行此操作,请参考How to determine what CloudFormation stack an AWS resource belongs to?
我有一个EC2实例,我想使用AWS CLI 知道它属于哪个云形成堆栈。
要在python中使用boto进行此操作,请参考How to determine what CloudFormation stack an AWS resource belongs to?
aws cloudformation describe-stack-resources --physical-resource-id i-xxxxxxxxxx
通常用您的实例ID或任何其他物理资源ID替换i-xxxxxxxxxx。
-physical-resource-id(字符串): 对应于AWS CloudFormation支持的资源的物理实例ID的名称或唯一标识符。 例如,对于Amazon Elastic Compute Cloud(EC2)实例,PhysicalResourceId对应于InstanceId。您可以将EC2 InstanceId传递给DescribeStackResources,以查找实例所属的堆栈以及该堆栈中还有哪些其他资源。 必需:有条件的。如果未指定PhysicalResourceId,则必须指定StackName。 默认:没有默认值。
参考:http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_DescribeStackResources.html