我正在尝试使用s3cmd工具来使我的文件无效,似乎s3cmd会自动为我选择一个发行版,但我在同一个存储桶中有更多的发行版,我如何选择要失效的发行版?
我已经尝试过了:
s3cmd sync —cf-invalidate myfile cf://XXXXXXXXXX/mypath,但它不工作。我明白了:Invalid source/destination”
有什么想法吗?
谢谢!
发布于 2013-09-23 18:48:40
我相信您会希望通过源(即您的S3存储桶或类似的存储桶)强制执行无效,如下所示:
s3cmd --cf-invalidate _site/ s3://example-origin.com/发布于 2015-06-08 04:14:31
以下是我的最终结论:
经过多次尝试,解决方案受到了很大的限制。
s3cmd sync --cf-invalidate --acl-public --preserve --recursive ./[local_folder] s3://[my_bucket]/[remote_folder]/
结尾
发布于 2015-04-18 02:19:16
我不能使s3cmd的失效工作,所以我使用s3cmd来更新文件,使用cloudfront-invalidator来做失效。
#!/bin/bash
if [ -z "$(which s3cmd)" ]; then
echo "s3cmd is not installed or is not on the PATH"
exit -1
fi
if [ -z "$(which cloudfront-invalidator)" ]; then
echo "cloudfront-invalidator is not installed or is not on the PATH"
echo "See https://github.com/reidiculous/cloudfront-invalidator"
echo "TL;DR: sudo gem install cloudfront-invalidator"
exit -1
fi
function awsKeyId {
awk -F '=' '{if (! ($0 ~ /^;/) && $0 ~ /aws_access_key_id/) print $2}' ~/.aws/config | tr -d ' '
}
function awsSecret {
awk -F '=' '{if (! ($0 ~ /^;/) && $0 ~ /aws_secret_access_key/) print $2}' ~/.aws/config | tr -d ' '
}
export file="stylesheets/main.css"
export distributionId=blahblah
export bucket=www.blahblah
s3cmd -P -m 'text/css' put public/$file s3://$bucket/$f
cloudfront-invalidator invalidate `awsKeyId` `awsSecret` $distributionId $filehttps://stackoverflow.com/questions/17121342
复制相似问题