ec_reboot.rb
# !/usr/bin/ruby
require 'rubygems'
require 'aws-sdk'
# require './config.rb'
# -----------------------------------
# config.rb の中身
config = {
"access_key_id" => "xxxxxxx",
"secret_access_key" => "xxxxxxx",
"sqs_endpoint" => "sqs.ap-northeast-1.amazonaws.com",
"elasticache_endpoint" => "elasticache.ap-northeast-1.amazonaws.com",
}
AWS.config(config)
# -----------------------------------------------
begin
ec = AWS::ElastiCache.new
params = {
:cache_cluster_id => 'xxxx',
:cache_node_ids_to_reboot => ['0001']
}
r = ec.client.reboot_cache_cluster(params)
puts "OK!"
rescue => exc
p exc.message
end