Lambda@Edge - You cannot update the specified distribution using this API version because it is associated with a cache policy

Viewed 1834

I am trying to setup Lambda@Edge but getting the following error on clicking Deploy to Lambda@Edge button.

You cannot update the specified distribution using this API version because it is associated with a cache policy.

My CloudFront distribution is already ready and is in Deployed state.

Can someone please help me with this issue?

enter image description here

3 Answers

Had this error :

You cannot update the specified distribution using this API version because it is associated with a cache policy. 
(Service: AmazonCloudFront; Status Code: 400; 
Error Code: IllegalUpdate;
 Request ID: xxxxxxxxxxx-xxxxx-49c2-b15e-6xxxxxxxxx; Proxy: null)

To solve :

  • I had cached policy already at 'Legacy cache settings'
  • Switched it back to managed optimised cache policy
  • Switched again to 'Legacy cache settings'

After this, error was gone.

Had same error trying to make some changes with terraform, you need to follow this steps to solve it:

  • Go to Cloudfront on the AWS console.
  • Choose your Cloudfront distribution.
  • Click on the Behaviours and choose edit on your origin.
  • On Cache and origin request settings choose Use legacy cache settings
  • Now you can customise the cache TTL values (Recommended: Minimum TTL: 0. Maximum TTL: 31536000, Default TTL: 86400).
Related