How to pause the awscli running until a Cloudfront cache invalidation completed

We can automate the Cloudfront cache invalidation process using the awscli commands. It will take some time to complete the invalidation process once triggered.

awscli provides an option to pause the further steps until the cache invalidation completed.

#aws cloudfront wait invalidation-completed --distribution-id DIST-ID --id INVAL-ID


<DIST-ID> need to be replaced with the Cloudfront distribution id.
<INVAL-ID> need to be replaced with the id of the cache invalidation process that triggered.

Please note that the command will not produce any output.

That's all…