6

I'm using "T2 Unlimited" instances with my AWS Elastic Beanstalk configuration.

The default instance termination policy (for when scaling down) terminates the oldest instances first. This is bad because the oldest instances are the ones most likely to have CPU credits built-up. I would like to change the instance termination policy to "newest first."

I tried this:

option_settings:
  aws:autoscaling:asg:
    TerminationPolicies: [
        "NewestInstance"
    ]

But got error:

Invalid option specification (Namespace: 'aws:autoscaling:asg', OptionName: 'TerminationPolicies'): Unknown configuration setting.

This isn't too surprising since this option isn't listed as a valid option.

So how can I make so when Beanstalk creates a new auto-scaling-group for an environment, it automatically sets the termination policy to newest first?

Perhaps this is unnecessary because auto-scaling-groups are only created when the environment is created?

womble
  • 96,255
  • 29
  • 175
  • 230
Dan Sandberg
  • 161
  • 2

1 Answers1

3

The following works for me. I use .ebextensions folder to configure my apps. Inside I have created a termination.config file containing this:

   Resources:
      AWSEBAutoScalingGroup:
        Type: "AWS::AutoScaling::AutoScalingGroup"
        Properties:
          TerminationPolicies: [ "OldestInstance" ]
Marek Raki
  • 197
  • 1
  • 9