公式ドキュメント

AWS CLI コマンドの実行

頻度とかファイル数にもよるけど、とりあえずざっくり全クリア。

XXXXXXXXXXXXXXはdistribution-id、確認方法はこちらで。

1
$ aws cloudfront list-distributions

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
$ aws cloudfront create-invalidation --distribution-id XXXXXXXXXXXXXX --paths '/*'
AWS CLI support for this service is only available in a preview stage.

However, if you'd like to use the "aws cloudfront" commands with the
AWS CLI, you can enable this service by adding the following to your CLI
config file:

    [preview]
    cloudfront=true

or by running:

    aws configure set preview.cloudfront true

なんかメッセージでたので指示どおり実行

1
$ aws configure set preview.cloudfront true
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
$ aws cloudfront create-invalidation --distribution-id XXXXXXXXXXXXXX --paths '/*'
{
    "Invalidation": {
        "Status": "InProgress",
        "InvalidationBatch": {
            "Paths": {
                "Items": [
                    "/*"
                ],
                "Quantity": 1
            },
            "CallerReference": "cli-XXXXXXXXXXXX-XXXXX"
        },
        "Id": "XXXXXXXXXXXXXX",
        "CreateTime": "2017-04-09T01:54:42.985Z"
    },
    "Location": "https://cloudfront.amazonaws.com/2016-11-25/distribution/E3L5CA48AGLO7U/invalidation/I2BB6FIQJYY9GS"
}