Skip to content

Instantly share code, notes, and snippets.

@adamenger
adamenger / rolypoly.rb
Last active December 16, 2021 12:42
Elasticsearch Rolling Restart Script
require 'aws-sdk'
require 'elasticsearch'
require 'httparty'
require 'socket'
ec2 = AWS::EC2.new
# elasticsearch_cluster is just an array of ip's, so you could manually replace or use your api of choice to get them
elasticsearch_cluster = ec2.instances.with_tag('es_cluster_name', 'es_test').filter('instance-state-name', 'running').map{ |i| i.private_ip_address }
start_time = Time.now.to_i