LoginSignup
1
1

More than 5 years have passed since last update.

ruby aws sdk を使った Elasticache のリブート

Posted at
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
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1