'Make AWS CLI blocking during cloudfront invalidation creation

I want to bust my cloudfront cache during a CI job and then run an Algolia search crawler against the busted version:

aws cloudfront create-invalidation --distribution-id $AWS_CLOUDFRONT_DISTRIBUTION_ID --paths "/*"

However, this will basically return a status response with an assigned ID I can poll, which is something I would like to avoid.

The question therefore is, whether this command can be made blocking (could not find anything in the docs). I also found this question, but is not applicable since my command always exits with 0 exit code.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source