简体   繁体   English

如何彻底清除Amazon CloudFront缓存?

[英]How to clear Amazon CloudFront Cache completely?

I made some changes to my origin server which now serves different data from same url. 我对原始服务器进行了一些更改,该服务器现在可以从同一URL提供不同的数据。

I tried to clear my cache completely by doing the following invalidation in CF UI: 我试图通过在CF UI中执行以下无效操作来彻底清除缓存:

在此处输入图片说明

But this didn't work. 但这没有用。 How can I wipe off completely the Amazon CloudFront cache's in one go? 如何一次性彻底擦除Amazon CloudFront缓存?

CloudFront does now support wildcard or full distribution invalidation. CloudFront现在支持通配符或完全分发失效。 You will need do do one of the followng. 您需要执行以下一项操作。

  • Invalidate each object that has changed 使已更改的每个对象无效
  • Invalidate /* 无效/ *
  • Version your objects so that they are considered new (Ie rename or querystring) 对对象进行版本控制,以使它们被视为新对象(即,重命名或查询字符串)

http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html#invalidating-objects-console http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html#invalidating-objects-console

You need to use /* instead of / . 您需要使用/*代替/

Also, if you need to do this frequently, you can do it using the AWS CLI. 此外,如果您需要经常执行此操作,则可以使用AWS CLI执行此操作。

aws cloudfront create-invalidation --distribution-id=YOUR_DISTRIBUTION_ID --paths "/*"

Edit : thanks to @speckledcarp , you need to use "/*" (with quotes) when using the CLI. 编辑 :感谢@speckledcarp ,使用CLI时需要使用"/*" (带引号)。

根据AWS文档,您需要使用/ *代替/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM