AWS CLI:禁止发行 [英] AWS CLI: disable distribution

查看:216
本文介绍了AWS CLI:禁止发行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我也明白了,禁用CloudFront的分布的手段的更新其状态的,并且必须能够将其删除。

由于AWS CLI的很稀疏的文档,我找的是如何只使用CLI做更新一个小例子。

解决方案

虽然我不能为你提供一个最小的例子,下面应该工作。您可以从您的发行版的储存库JQ或 http://stedolan.github.io/jq/manual/

  1. 获取Etag的,会需要它第3步:

    $ AWS CloudFront的获取,分发,配置--id E123456 | JQ。 | .ETag

获取当前配置:

<醇开始=2>
  • $ AWS CloudFront的获取,分发,配置--id E123456 | JQ。 | .DistributionConfig'>的/ tmp /禁用分布-E123456

    修改的/ tmp /禁用分布-E123456,分布配置文件来禁用。

    相关部分:

     DefaultRootObject:空,
    价格查询:PriceClass_All,
    已启用:真实,&LT;  - 设置为false
     

  • 更新分发:

    <醇开始=3>
  • $ AWS CloudFront的更新分布--id E123456 - - 如果匹配E3SVA578MZF6JZ --distribution-config文件:/// TMP /禁用分布-E123456
  • As far as I have understood, disabling a cloudfront distribution means updating it's status and is necessary to be able to delete it.

    Given the very sparse documentation of the AWS CLI, I am looking for a minimal example of how to do that update using just the CLI.

    解决方案

    While I can't provide you a minimal example, the following should work. You can obtain jq from your distribution's repository or from http://stedolan.github.io/jq/manual/.

    1. Get the Etag, will need it for step 3:

      $ aws cloudfront get-distribution-config --id E123456 | jq '. | .ETag'

    Get current config:

    1. $ aws cloudfront get-distribution-config --id E123456 | jq '. | .DistributionConfig' > /tmp/disable-distribution-E123456

      Modify /tmp/disable-distribution-E123456, distribution config file to disable.

      Relevant section:

      "DefaultRootObject": null,
      "PriceClass": "PriceClass_All",
      "Enabled": true,  <-- Set to false
      

    Update Distribution:

    1. $ aws cloudfront update-distribution --id E123456 --if-match E3SVA578MZF6JZ --distribution-config file:///tmp/disable-distribution-E123456

    这篇关于AWS CLI:禁止发行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆