No commit activity in last 3 years
No release in over 3 years
Simple gem to invalidate a list of keys belonging to a Cloudfront distribution
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Usage

invalidator = CloudfrontInvalidator.new(AWS_KEY, AWS_SECRET, CF_DISTRIBUTION_ID)
list = %w[
  index.html
  favicon.ico
]
invalidator.invalidate(list) do |status,time|   # Block is optional.
  invalidator.list                              # Or invalidator.list_detail
  puts "Complete after < #{time.to_f.ceil} seconds." if status == "Complete"
end

A command line utility is also included.

$ cloudfront-invalidator invalidate $AWS_KEY $AWS_SECRET $DISTRIBUTION_ID index.html favicon.ico
$ cloudfront-invalidator list $AWS_KEY $AWS_SECRET $DISTRIBUTION_ID
$ cloudfront-invalidator list_detail $AWS_KEY $AWS_SECRET $DISTRIBUTION_ID

Amazon IAM Policy

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": [
        "cloudfront:CreateInvalidation",
        "cloudfront:GetInvalidation",
        "cloudfront:ListInvalidations"
      ],
      "Effect": "Allow",
      "Resource": "*"
    }
  ]
}

Authors

  • Reid M Lynch
  • Jacob Elder