For amazon ec2, use CreateFleet to launch spot instance instead of RequestSpotInstances
As mentioned in this AWS official document, RequestSpotInstances
is a legacy API with no planned investment. It's recommended to use CreateFleet
or CreateAutoscalingGroup
to launch spot instances. I think CreateFleet
is more suitable and simple for autoscaling runner.
To compare with RequestSpotInstances
, CreateFleet
is more flexible in allocation strategy and makes autoscaling runner more robust. capacity-optimized
strategy can launch spot instances from the most available instance pools and set a priority for each instance type.
For testing this idea, I simply replaced RequestSpotInstances
with CreateFleet
API and upgraded aws-sdk-go
to 1.44.70
in docker machine. My docker machine worked fine with autoscaling runner. It seems that CreateFleet
is compatible with the current docker machine. Of course, I need to do more tests to make sure this changes won't break other functions.
Are you willing to make a schedule to adapt CreateFleet
API for the amazon ec2 driver? I'm glad to implement this feature.