AWS cli——query没有返回预期的JMES路径


aws route53 list-hosted-zones --profile myprofile

返回
{
"HostedZones": [
{
"Id": "/hostedzone/Z0874178161VQMKVVVJBT",
"Name": "mydomain.org",
"CallerReference": "RISWorkflow-RD:62a669b6-5465-4741-bb96-671e0be70b10",
"Config": {
"Comment": "HostedZone created by Route53 Registrar",
"PrivateZone": false
},
"ResourceRecordSetCount": 4
}
]
}

我想要得到Id值,而且只得到Id值。

基于https://jmespath.org/tutorial.html我认为下面的第一个命令应该工作,但我不能得到Id的值。我将输出粘贴到JmesPath站点,它认为第一行应该可以工作

aws route53 list-hosted-zones --profile admin1 --query HostedZones[0].Id
zsh: no matches found: HostedZones[0].Id
aws route53 list-hosted-zones --profile admin1 --query HostedZones.Id   
null
aws route53 list-hosted-zones --profile admin1 --query Id 
null

您可以通过
aws route53 list-hosted-zones --profile admin1 --query 'HostedZones[].{ID: Id}'

获取id