By using AWS re:Post, you agree to the Terms of Use
/Error when calling aws cloudfront create-invalidation/

Error when calling aws cloudfront create-invalidation


A deploy script running in a codebuild job part of a codepipeline pipeline is failing. The script has been running fine for several months until now.

The command called is: aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths '/*'

The exception we get is: An error occurred (ServiceUnavailable) when calling the CreateInvalidation operation (reached max retries: 2): CloudFront encountered an internal error. Please try again.

Running the command locally works fine.

  • I experienced the same issue today in our GHA workflow which uses this command:

    aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_ID_STAGING }} --paths /\*

    Re-ran the failed workflow and it's passed. But not sure why and when it happens. AWS status page tells me that Cloudfront service stays healthy. :-(

1 Answers
Accepted Answer

To find out the error cause, an investigation of the internal logs might be required. The best way for resolving such kind of issues is probably just contacting AWS Support, so the support team can look into this. Please open a support request.

answered 2 months ago
  • The problem with AWS support is that for questions outside of billing, the support is paid. This means bug reports like this have no where to go. It seems like it was a bug btw, because now it's working without any changes from our side. Thanks for the answer!

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions