Compare commits

...

5 Commits

Author SHA1 Message Date
Jeff Moe ce3ed8324c get list of prices, lowest first
3 years ago
Jeff Moe edcccf4c97 grab all spot prices
3 years ago
Jeff Moe bb5fa70b9c spots & hosts
3 years ago
Jeff Moe 4de6f9a351 spot price hard code
3 years ago
Jeff Moe 9c00fbc466 spot price hard code
3 years ago

@ -1,4 +1,4 @@
#!/bin/bash
# eqx-cluster-create # eqx-cluster-create
# #
# Create a cluster of bare metal on Equinix. # Create a cluster of bare metal on Equinix.
@ -28,7 +28,8 @@ EQXSPOTOVER=".02"
# Probably leave these variables alone # Probably leave these variables alone
# Set max price at current spot plus EQXSPOTOVER from above # Set max price at current spot plus EQXSPOTOVER from above
EQXSPOT="`eqx-market-spot-prices`" # XXX spot device/facility is hard coded in other script
EQXSPOT="`eqx-market-spot-price`"
EQXSPOTMAX=`echo "$EQXSPOT + $EQXSPOTOVER" | bc -l | xargs printf "%1.2f"` EQXSPOTMAX=`echo "$EQXSPOT + $EQXSPOTOVER" | bc -l | xargs printf "%1.2f"`
EQXPROJECT="$1" EQXPROJECT="$1"
if [[ $1 == "" ]] if [[ $1 == "" ]]

@ -7,7 +7,9 @@ EQXDEVICEID="$1"
if [[ $1 == "" ]] if [[ $1 == "" ]]
then \ then \
echo -e "Need device name" echo -e "Need device ID"
echo -e "To get device IDs in a project, run:"
echo -e "eqx-get-project-devices [project name]"
echo echo
exit exit
fi fi

@ -0,0 +1,9 @@
#!/bin/bash
# Gets lowest spot price for device type hardcoded in script below
eqx-market-spot-prices | \
jq '.spot_market_prices | .[]."m3.large.x86".price' | \
sort -Vu | \
grep -v null

@ -0,0 +1,16 @@
#!/bin/bash
# eqx-market-spot-price
EQXTOKEN=`cat ~/.packet-cli.json | jq ".token" --raw-output`
curl \
--silent \
-X GET \
--header 'Accept: application/json' \
--header "X-Auth-Token: ${EQXTOKEN}" \
'https://api.equinix.com/metal/v1/market/spot/prices' | \
jq '.spot_market_prices.da11."m3.large.x86".price'
# jq '.spot_market_prices.da11."c3.small.x86".price'

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# eqx-market-spot-prices # eqx-market-spot-price
EQXTOKEN=`cat ~/.packet-cli.json | jq ".token" --raw-output` EQXTOKEN=`cat ~/.packet-cli.json | jq ".token" --raw-output`
@ -8,9 +8,5 @@ curl \
-X GET \ -X GET \
--header 'Accept: application/json' \ --header 'Accept: application/json' \
--header "X-Auth-Token: ${EQXTOKEN}" \ --header "X-Auth-Token: ${EQXTOKEN}" \
'https://api.equinix.com/metal/v1/market/spot/prices' | \ 'https://api.equinix.com/metal/v1/market/spot/prices'
jq '.spot_market_prices.da11."m3.large.x86".price'
# jq '.spot_market_prices.da11."c3.small.x86".price'

Loading…
Cancel
Save