【发布时间】:2021-05-24 02:48:38
【问题描述】:
我想查询 AWS Stack Resource Aws Cl,以便获取 PhysicalResourceId。
为了描述堆栈和查询它在这篇文章中被反对。
如果我想描述我的堆栈资源,我使用这个命令
aws cloudformation describe-stack-resource --stack-name banana --logical-resource-id orange
有没有办法从输出中获取 PhysicalResourceId。哪个是Json格式?
{
"StackResourceDetail": {
"StackName": "strawbery",
"StackId": "arn:aws:cloudformation:us-west-2:0000000000:stack/orange/pinaple",
"LogicalResourceId": "PotatoInstance",
"PhysicalResourceId": "i-00000000001",
"ResourceType": "AWS::EC2::Instance",
"LastUpdatedTimestamp": "orange",
"ResourceStatus": "CREATE_COMPLETE",
"Metadata": "{}",
"DriftInformation": {
"StackResourceDriftStatus": "NOT_CHECKED"
}
}
}
我认为如果我使用 awk 会有办法,但我不知道如何使用它。
awk
更新:
我需要使用 awk,因为它将在管道中完成,并且管道没有安装 jq。
【问题讨论】: