From time to time when trying to create invalidation with AWS CloudFront (using a CI pipelines) with the following command:
aws cloudfront create-invalidation --distribution-id "${cloudfront_id}" --paths "/*"
I get the following error message:
An error occurred (ServiceUnavailable) when calling the CreateInvalidation operation (reached max retries: 2): CloudFront encountered an internal error. Please try again.
And a re-run of the CI pipeline usually works.
I am trying to figure out how to set a max retries that is bigger than 2 (like the error message indicates) -
with the hope of it fixing it, since a re-run does work in those cases -
and\or fix it in some other way.
The docs didn't had anything related or even the error specified..
Worth mentioning that the environment I am using is GitHub Actions on ubuntu-latest (which is currently at 22.04) with aws cli pre-installed
You can set max_attempts
in the AWS config, default location is: ~/.aws/config
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-retries.html#cli-usage-retries-configure
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With