小编Eln*_*dov的帖子

按标签列出的 AWS Cloudfront 分配 ID

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

aws cloudfront list-tags-for-resource --resource XXX
{
   "Tags": {
       "Items": [
           {
               "Value": "TEST_APP",
               "Key": "CLIENT_APP"
           }
       ]
   }
}
Run Code Online (Sandbox Code Playgroud)

更新

解决通过

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

Run Code Online (Sandbox Code Playgroud)

amazon-web-services amazon-cloudfront aws-cli

7
推荐指数
1
解决办法
2207
查看次数

AWS Cloudformation - 如何使用If Else条件

我是编写AWS Cloudformation模板的新手.我试图在我的CF模板上使用If Else条件.如何在资源中使用if else语句?

If AWS::Region == eu-central-1 ==> create resource , else continue.
Run Code Online (Sandbox Code Playgroud)

amazon-web-services aws-cloudformation

4
推荐指数
1
解决办法
1671
查看次数