How can I specify that I only want Spot Instances for my Elastic Beanstalk application?

Viewed 710

My env.yaml has:

  aws:ec2:instances:
    InstanceTypes: g4dn.xlarge,c5.4xlarge,r5.2xlarge,r5a.xlarge
    EnableSpot: true
    SpotMaxPrice: "0.15"

but when I do eb create, it still asks me:

Would you like to enable Spot Fleet requests for this environment?
(y/N): y
Enter a list of one or more valid EC2 instance types separated by commas (at least two instance types are recommended).
(Defaults provided on Enter):

Why is it not respecting the env.yaml file?

1 Answers

To specify that you don't want any on-demand instances you can use SpotFleetOnDemandBase and SpotFleetOnDemandAboveBasePercentage:

  • SpotFleetOnDemandBase: The minimum number of On-Demand Instances that your Auto Scaling group provisions before considering Spot Instances as your environment scales up.

  • SpotFleetOnDemandAboveBasePercentage: The percentage of On-Demand Instances as part of additional capacity that your Auto Scaling group provisions beyond the SpotOnDemandBase instances.

The use of the options is exemplified in Example 2. Specifically, if both options are set to 0, no on-demand instances will be used.

Related