Amazon web services AWS Cloudfront分发ID(按标签)

Amazon web services AWS Cloudfront分发ID(按标签),amazon-web-services,amazon-cloudfront,aws-cli,Amazon Web Services,Amazon Cloudfront,Aws Cli,是否可以通过awscli或aws sdk for powershell通过标签获取aws cloudfront dist id。我只能通过资源的ARN编号获取ID aws cloudfront list-tags-for-resource --resource XXX { "Tags": { "Items": [ { "Value": "TEST_APP", "Key": "CLIENT_APP

是否可以通过awscli或aws sdk for powershell通过标签获取aws cloudfront dist id。我只能通过资源的ARN编号获取ID

aws cloudfront list-tags-for-resource --resource XXX
{
   "Tags": {
       "Items": [
           {
               "Value": "TEST_APP",
               "Key": "CLIENT_APP"
           }
       ]
   }
}
更新

通过解决

cloudfrontdistids=$(aws cloudfront list-distributions | jq -r ".DistributionList.Items[].ARN")
for dist in $cloudfrontdistids
do
        if [ $(aws cloudfront list-tags-for-resource --resource $dist | jq -r ".Tags.Items[].Value") == $VALUE ]
        then
                CLOUDFRONT_DISTRIBUTION_ID=${dist:(-14)}
        fi
done


我很惊讶CLI没有更简单、更有效的方法来实现这一点。我自己也找不到。如果你不能通过提供标记参数来搜索列表,那么标记有什么意义呢?这是一个答案,如果任何一个偶然发现,没有下载整个名单