Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

43 lines (35 sloc) 1.089 kb

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
Jump to Line
Something went wrong with that request. Please try again.