ubicloud/prog/aws
Enes Cakir 5bcce12c32 Retry on alternative instance type for insufficient capacity errors
Spot instance requests can sometimes fail with an
“InsufficientInstanceCapacity” error. Best practice is to request
multiple instance types to increase the chances of obtaining a spot
instance. Unfortunately, create_instance in E2 does not support multiple
instance types in a single request.

One recommended solution is to create an EC2 fleet with multiple
instance types and provision the spot instance from the fleet. However,
since we don’t know the required instance count beforehand, this would
require creating a separate fleet for each instance. Additionally, it
creates divergence with PG on AWS service.

Instead of creating a fleet, we can handle this by retrying the
create_instance call with alternative instance types until we try all
whenever an “InsufficientInstanceCapacity” error occurs.
2025-10-06 15:06:26 +03:00
..
instance.rb Retry on alternative instance type for insufficient capacity errors 2025-10-06 15:06:26 +03:00
nic.rb Fix Vnet::NicNexus#destroy to not violate strand leases 2025-10-03 17:51:41 +03:00
vpc.rb Fix Vnet::SubnetNexus#destroy to not violate strand leases 2025-10-03 17:51:41 +03:00