![](/img/trans.png)
[英]How do I create an exponential distribution in Ruby with the distribution gem?
[英]Ruby gem to invalidate CloudFront Distribution?
我已經嘗試了所有可以在Google和Stackoverflow上找到的gem,它們似乎都已過時且無法維護,那么從Ruby禁用CloudFront發行版的最簡單方法是什么?
https://rubygems.org/gems/aws-sdk
具體來說是cloudfront模塊:
https://docs.aws.amazon.com/sdkforruby/api/Aws/CloudFront.html
如果您具有正確的IAM角色等設置,這應該為您提供對Cloudfront資源的完全CLI控制。
這是我們最終用來使整個緩存無效的小腳本:
require 'aws-sdk-cloudfront'
cf = Aws::CloudFront::Client.new(
access_key_id: ENV['FOG_AWS_ACCESS_KEY_ID'],
secret_access_key: ENV['FOG_AWS_SECRET_ACCESS_KEY'],
region: ENV['FOG_REGION']
)
resp = cf.create_invalidation({
distribution_id: ENV['FOG_DISTRIBUTION_ID'], # required
invalidation_batch: { # required
paths: { # required
quantity: 1, # required
items: ["/*"],
},
caller_reference: DateTime.now.to_s, # required
},
})
if resp.is_a?(Seahorse::Client::Response)
puts "Invalidation #{resp.invalidation.id} has been created. Please wait about 60 seconds for it to finish."
else
puts "ERROR"
end
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.