(AWS Spot) Add 0.5 cents to discovered spot price

Related to #2979 , in volatile spot markets the automatic price can
cause your instances to be evicted if the spot price rises. This change
adds one half a cent to your bid to protect against small amounts of
price volatility.
This commit is contained in:
Ryan S. Brown 2016-06-29 07:00:21 -04:00
parent 8e2bca030c
commit c68ddef4e9
1 changed files with 4 additions and 0 deletions

View File

@ -129,6 +129,10 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
} else {
// Add 0.5 cents to minimum spot bid to ensure capacity will be available
// Avoids price-too-low error in active markets which can fluctuate
price = price + 0.005
}
spotPrice = strconv.FormatFloat(price, 'f', -1, 64)