A FaaSpot spot is a VM that can run your functions. You can run multiple concurrent functions on one spot. Nevertheless, the more spots that you have, the more concurrent functions you'll be able to run.
The cool thing about FaaSpot, is that you pay for each spot that you have, regardless to the number of functions that you run on it. Having said that, to run a function in FaaSpot you will need at least one FaaSpot spot.
To add a spot to your spot's pool, you need to use the spots API:
CLI
You can manage your spots using the fas
CLI:
$ fas spots add --wait
Python
You can manage your spots using the fas
python-client:
from faaspot import Faaspot
faaspot = Faaspot()
faaspot.spots.add(wait=True)
HTTP Request
You can manage your spots using the direct HTTP requests:
$ curl -X PUT --header "Authorization: Token MY_TOKEN" https://api.faaspot.com:443/v1/spots/
Note
What is the wait
argument?
By default, requests run in the background, in a synchronized manner. This means that the request will return the execution ID. You can then check that execution status (completed or not), using the execution ID.
When using the FaaSpot client, you can run the command in a synced manner (wait until you receive a response),
using the wait
argument.
When using the HTTP request to add a spot, you'll need to check the execution status manually. To see how to do it, go to the executions page.
To retrieve a list of all the spots that you have, use the spots list API:
CLI
You can manage your spots using the fas
CLI:
$ fas spots list
Python
You can manage your spots using the fas
python-client:
from faaspot import Faaspot
faaspot = Faaspot()
faaspot.spots.list()
HTTP Request
You can manage your spots using the direct HTTP requests:
$ curl -X GET --header "Authorization: Token MY_TOKEN" https://api.faaspot.com:443/v1/spots/
To remove a spot from your spot's pool, you need to use the spots API:
CLI
You can remove one spot from your spots pool using the CLI:
$ fas spots remove --wait
Python
You can remove one spot from your spots pool using the python-client:
from faaspot import Faaspot
faaspot = Faaspot()
faaspot.spots.remove(wait=True)
HTTP Request
You can remove one spot from your spots pool using a direct HTTP request:
$ curl -X DELETE --header "Authorization: Token MY_TOKEN" https://api.faaspot.com/v1/spots/
This API will return the execution ID of the spot removal task. To get the execution status of that task, you will need to query the execution status. You can see how to do it in the executions page.
Note
What is the wait
argument?
By default, requests run in the background, in a synchronized manner. This means that the request will return the execution ID. You can then check that execution status (completed or not), using the execution ID.
When using the FaaSpot client, you can run the command in a synced manner (wait until you receive a response),
using the wait
argument.
When using the HTTP request to remove a spot, you'll need to check the execution status manually. To see how to do it, go to the executions page.
The spots are actual VMs, with a public IP address. Sometimes, there is a need to give the spots a new IP, not a specific IP, just a different one. You can do it using a FaaSpot refresh_ip request.
CLI
You can refresh the IP address of your spots, using the CLI:
$ fas spots refresh_ip --wait
The refresh_ip command parameters:
Python
You can refresh the IP address of your spots, using the python-client:
from faaspot import Faaspot
faaspot = Faaspot()
faaspot.spots.refresh_ip(wait=True)
The refresh_ip command parameters:
HTTP Request
You can refresh the IP address of your spots, using direct HTTP requests:
$ curl -X PATCH --header "Authorization: Token MY_TOKEN" https://api.faaspot.com/v1/spots/ \
--data '{"refresh_ip": "all"}'
$ curl -X PATCH --header "Authorization: Token MY_TOKEN" https://api.faaspot.com/v1/spots/ \
--data '{"refresh_ip": "SPOT_IP_TO_REFRESH"}'
This API will return the execution ID of the spot refresh_ip task. To get the execution status of that task, you will need to query the execution status. You can see how to do it in the executions page.