Sha256: 390aec357ff2fc8063e8ef5dd954de93cca956e7ac8fdce4f8fa3c06d58c8a31
Contents?: true
Size: 879 Bytes
Versions: 8
Compression:
Stored size: 879 Bytes
Contents
module Hashicorptools class UpdateLaunchConfiguration < Thor desc 'deploy ASG_NAME', 'recycle instances in the ASG with no downtime' option :aws_region, default: 'us-east-1' def deploy(asg_name) asg = AutoScalingGroup.new(name: asg_name, region: options[:aws_region]) if asg.group.nil? raise "could not find asg #{asg_name}" end current_count = asg.group.instances.size || 1 if asg.group.max_size < (current_count * 2) raise "max size must be more than twice current count to deploy a new AMI" else # first doulbe the instance count to get new launch config live. asg.set_desired_instances(current_count * 2) # then bring the instance count back down again. asg.set_desired_instances(current_count) asg.verify_all_instances_using_correct_ami end end end end
Version data entries
8 entries across 8 versions & 1 rubygems