Amazon-CloudFormation [SOLVED]: Perform RollingUpdate using Cloudformation with Spot Instances

Amazon-CloudFormation [SOLVED]: Perform RollingUpdate using Cloudformation with Spot Instances

Home Forums Amazon Web Services Amazon CloudFormation Amazon-CloudFormation [SOLVED]: Perform RollingUpdate using Cloudformation with Spot Instances

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #247031

    Cloudy Point
    Keymaster

    QuestionQuestion

    I am using cloudformation UpdatePolicy attribute to perform a rolling update in case of any change to my ec2 launch configuration. This works fine while using on demand instances. But when I use spot instances I get below error:

    Autoscaling rolling updates cannot be performed because the current launch configuration is using spot instances and MinInstancesInService is greater than zero.
    

    Setting MinInstancesInService property to zero make it work but then I get around 3-5 min downtime.

    Is there a way to achieve this without the downtime using Cloudformation? If not can someone point towards a better way to automate this rolling update process as I have multiple environments and doing it manually is very error prone. Thanks

    #247032

    Cloudy Point
    Keymaster

    Accepted AnswerAnswer

    You cannot set MinInstancesInService to anything other than 0 when using spot instances, because spot instances can be terminated at any time, thus making it impossible for AWS to guarantee a minimum number of instances to be kept in service during the rolling update.

    However, you can set the MaxBatchSize param in your UpdatePolicy to 1, so only one instance will be updated at a time. To ensure high availability, you must make sure there are 2 or more instances available in your AutoScalingGroup, otherwise the rolling update will terminate your single instance, resulting in downtime.

    Source: https://stackoverflow.com/questions/47931206/perform-rollingupdate-using-cloudformation-with-spot-instances
    Author: spg
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.