s3cmd icon indicating copy to clipboard operation
s3cmd copied to clipboard

How to purge cache directly from s3cmd

Open ryjanx opened this issue 3 years ago • 3 comments

Hello.

Is there a s3cmd command to purge the cache? It's so annoying to always purge the cache from the dashboard.

Thanks in advance!

ryjanx avatar May 18 '22 13:05 ryjanx

That's a really good idea!

Do you normally invalidate the whole site ( /* ) or just a few files?

robd003 avatar May 29 '22 17:05 robd003

Normally the whole site. But both is good options to have..

ryjanx avatar Jun 03 '22 07:06 ryjanx

I'm right that your are speaking about the "cloudfront" invalidation? if yes, there is a pending work to allow it.

fviard avatar Aug 28 '22 00:08 fviard

The cfinval command was just added in MASTER to manually request invalidation for paths.

Examples of usage:

  • Invalidate 2 files: s3cmd cfinval "s3://mybucket/file1" "s3://mybucket/other/file.txt"
  • Invalidate the whole bucket: s3cmd cfinval "s3://mybucket"
  • Invalidate all the content of a folder: s3cmd cfinval "s3://mybucket/folder1/"
  • Invalidate files using a wildcard: s3cmd cfinval "s3://mybucket/folder1/images-2022*"

fviard avatar Oct 14 '22 13:10 fviard