Sha256: f282a31e59561b8e2ec2e467e28ea7af5649205eab1a4d7dd535ef23790538d7
Contents?: true
Size: 752 Bytes
Versions: 7
Compression:
Stored size: 752 Bytes
Contents
module Hashicorptools class UpdateLaunchConfiguration < Thor desc 'deploy ASG_NAME', 'recycle instances in the ASG with no downtime' def deploy(asg_name) asg = AutoScalingGroup.new(name: asg_name) 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) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems