Amazon web services 如何查询AWS堆栈输出?

Amazon web services 如何查询AWS堆栈输出?,amazon-web-services,amazon-cloudformation,aws-cli,Amazon Web Services,Amazon Cloudformation,Aws Cli,我的堆栈输出: "Outputs": [ { "OutputKey": "InstanceId", "OutputValue": "i-0ed2834d95ae5bb98", "Description": "Instance

我的堆栈输出:

            "Outputs": [
            {
                "OutputKey": "InstanceId",
                "OutputValue": "i-0ed2834d95ae5bb98",
                "Description": "Instance Id"
            },
            {
                "OutputKey": "PrivateIp",
                "OutputValue": "10.176.66.46",
                "Description": "Private IP address"
            },
            {
                "OutputKey": "EbsVolumeId",
                "OutputValue": "vol-03837489a20032881",
                "Description": "EbsVolume"
            }
我试图使用下面的命令查询堆栈的PrivateIp,但该命令没有返回任何内容

aws cloudformation describe-stacks --stack-name my-stack-01 --query "Stacks[0].Outputs[?OutputKey=="PrivateIp"].OutputValue" --output text
我做错了什么


提前谢谢

您必须在查询的筛选部分
?OutputKey==“PrivateIp”
中使用单引号。因此,将整个查询更改为:

aws cloudformation描述堆栈——堆栈名称my-stack-01——查询“堆栈[0]。输出[?OutputKey=='PrivateIp']。OutputValue”--输出文本


这会有用的。

非常感谢您!!!