(Mis)adventures in the AWS spot market
david karapetyan Feb 04, 2018
Some miscellaneous facts and figures I gathered while trying to play around with the AWS spot market.
Spot requests, a.k.a. bids, go onto the Amazon order book and then the requests transition through a few states and statuses. The states are still not clear to me. While putting in requests I was able to configure most of the variables I expect to be able to configure for an EC2 instance. One thing I liked is that there is an event stream associated with the request and when a request is canceled it also kills any associated instances for that request, assuming the request was actually fulfilled with a running EC2 instance.
This is what the event stream looks like but it is not clear if there is an associated API with webhooks for the lifecycle of the request and the associated instance
The above event stream includes one of the errors I encountered. That one is about exceeding some kind of limit that I didn't know was in place so I guess it's nice that they let you know. Another one I ran into was being throttled, presumably because I was limited to one spot instance at a time and I requested 3
It is a little unfortunate and confusing that the requests have state and status. I'm pretty sure status could just have been part of the state but in true Amazon fashion it is another field in the request
So it looks like a request can be
submitted in terms of state and the status can be empty or
fulfilled but I'm sure there are other types of states and statuses that I didn't run into.
I'm still waiting to see the costs I incurred because I'm curious to see how the billing actually works out. I'll need to do another experiment on some more instances where the price is more volatile because I still can't tell how the billing works and how the price is fixed and modified throughout the lifetime of the instance. I'll also probably dig into the API and figure out how all of this looks like like from the API side because for real programmatic control it is not possible to avoid the API and the lifecycle events.