The Spot Market¶
The Equinix Metal™ Spot market allows users to bid on spare server capacity at reduced rates. In exchange, you give Equinix Metal the right to revoke any instance with only a two minute warning. If you have portable workload, the Spot market is an excellent tool to help you reduce your costs.
How Does the Spot Market Work?¶
The spot market is a marketplace with constantly changing inventory. You can place bids on this inventory by defining a variety of factors such as the maximum price you are willing to pay for a particular resource, number and type of servers, whether you want all or some of the order filled at any given time, etc.
For example, you can provision five instances with the maximum price you want to pay per hour per instance. If your price is equal to or greater than the current spot price for the given metro and plan, then the instances will be created for you.
These instances are volatile, which means that they can be revoked by Equinix Metal at any time if another user bids with a higher price. If your instance is going to be revoked, it will receive a termination time that is at least two minutes in length.
Spot Market Request Creation¶
To make a spot market request, send a POST
request to the projects/{id}/spot-market-requests
endpoint. In the body of the request, define the details of your request.
curl -X POST \
-H "Content-Type: application/json" \
-H "X-Auth-Token: <API_TOKEN>" \
"https://api.equinix.com/metal/v1/projects/{id}/spot-market-requests" \
-d '{
"devices_max": 2,
"devices_min": 1,
"max_bid_price": 0.10,
"instance_parameters": {
"hostname": "test.server.com-api",
"plan": "c1.small.x86",
"operating_system": "centos_8",
"metro": "sv"
}
}'
The `devices_max`, `devices_min`, `max_bid_price`, and `instance_parameters` fields are all required. The `instance parameters` object needs to contain `hostname`, `plan`, `operating_system`, and `metro`. `instance_parameters` can also contain any of the other fields used to provision and configure servers through the API. A complete list of those fields is in the API reference for the [`/projects/{id}/devices`](https://deploy.equinix.com/developers/api/metal/#tag/Devices/operation/createDevice) endpoint.
If you would like your request to expire after a certain amount of time, be sure to add the end_at
field with the date and UTC time of expiration in ISO8601 format.
curl -X POST \
-H "Content-Type: application/json" \
-H "X-Auth-Token: <API_TOKEN>" \
"https://api.equinix.com/metal/v1/projects/{id}/spot-market-requests" \
-d '{
"devices_max": 2,
"devices_min": 1,
"max_bid_price": 0.10,
"end_at": "2020-09-24T05:00:00Z",
"instance_parameters": {
"hostname": "test.server.com-api",
"plan": "c3.small.x86",
"operating_system": "centos_8",
"metro": "sv"
}
}'
Deleting a Spot Market Request¶
If you want you want to delete a spot market request, go to the list of requests in Project Settings on the Spot Market tab. Click Manage next to the request, which will slide out a details pane where you can delete it.
If you want to also delete any servers that were provisioned by the request, check the box next to Force termination.
To delete a request in the API, send a DELETE
to the /spot-market-requests/{id}
endpoint.
curl -X DELETE -H 'X-Auth-Token: <API_TOKEN>' https://api.equinix.com/metal/v1//spot-market-requests/{id}
If you want to also delete the provisioned servers, send force_termination=true
as a query parameter.
curl -X DELETE -H 'X-Auth-Token: <API_TOKEN>' https://api.equinix.com/metal/v1/spot-market-requests/{id}?force_termination=true
Spot Market Termination¶
Termination of spot market servers occurs when your max bid price is below the current spot price max or if demand for servers has increased and your device has the lowest price of all the spot market instances. A server that is marked for termination has 120 seconds before it is removed.
A server that will be terminated has will have a blue indicator next to the server name on your Servers page, but ascertaining when an instance will be terminated is not visible through our customer portal. Termination time is available in the API or from the server's metadata.
To determine a server's termination time send a GET
request to the /devices/{id}
endpoint.
curl -X GET -H 'X-Auth-Token: <API_TOKEN>' https://api.equinix.com/metal/v1/devices/{id}
The field termination_time
contains the UTC time in ISO8601 format when the instance will be terminated. If the response is null
, it indicates that no termination time has been set.
You can also grab a list of all devices in a project and their info from the /projects/{id}/devices
endpoint.
To query the server itself for termination time, you can cURL its metadata. From the server itself, run:
curl -s https://metadata.platformequinix.com/metadata
The response will contain a termination date/time or it will be null
.
Converting a Spot Market server to On Demand¶
If you have a spot market server that you need to keep, you can use the API to convert it to an on demand server. Once it is an on demand server, it will not be subject to termination, and it will be billed at the on demand price for the rest of its existence.
Note that servers that have been marked for termination are not eligible for conversion. You must convert your spot market server to on demand before it is selected for termination.
To convert, send a PUT
request to the /devices/{id}
endpoint with the body of the request containing the metro where the server lives and "spot_instance": false
.
curl -X PUT \
-H "Content-Type: application/json" \
-H "X-Auth-Token: <API_TOKEN>" \
"https://api.equinix.com/metal/v1/devices/{id}" \
-d '{
"metro": "sv",
"spot_instance": false
}'
Current and Historical Market Pricing¶
The current market price reflects the price you need to specify to deploy a single instance at this point in time. If the listed spot market price is 10x the standard price for a server of that type, then we are out of capacity for spot market instances in that location.
The current market price, the on demand price and the price trends from the last 24 hours are displayed on the page if you are placing spot market requests in the Equinix Metal console.
In the API, the /market/spot/prices
endpoint will provide the current prices for each Equinix Metal metro and plan.
curl -X GET -H 'X-Auth-Token: <API_TOKEN>' https://api.equinix.com/metal/v1/market/spot/prices
To see price history for a specific location and server, the /market/spot/prices/history?plan&metro
endpoint will allow you to check spot market prices for the last 90 days.
curl -X GET -H 'X-Auth-Token: <API_TOKEN>' https://api.equinix.com/metal/v1/market/spot/prices/history?plan&metro
Bidding Strategies¶
While your specific bidding strategy is obviously entirely up to you, most users adopt one of these bidding strategies based on their use case.
Strictly Optimize Cost - Sacrifice availability for the deepest discount. This is great for long-running workloads that have flexible end dates.
- Use Case: Research-style tasks
- Suggested Bid: near minimum
Cost/Availability Balance - Slightly higher price than strictly cost optimized, but allows you to increase the likelihood of getting and keeping an instance for longer periods of time.
- Use Case: Batch jobs that can handle some amount of reclamation
- Suggested Bid: 10-20% above minimum
Bid On Demand Price - Receive a discount anytime the spot price is lower than on demand, immediately switching to on demand when it goes higher.
- Use Case: Fully cloud native applications capable of easily moving workloads around
- Suggested Bid: on demand price
Optimize Continuity - Bid very high to ensure availability and continuity.
- Use Case: Accept some periods of higher-than-market prices in return for uptime continuity
- Suggested Bid: 2x-3x on demand price