aboutsummaryrefslogtreecommitdiffstats
path: root/jjb/common/include-agl-get-cost.sh
blob: d9ca9725ba4dcff6b02306eff78c955e0d0d6fc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
echo "########## Job cost (estimate) ############"

set +e
#set -x
# Retrieve the current uptime (in seconds)
uptime=$(awk '{print $1}' /proc/uptime)
# Convert to integer by truncating fractional part' and round up by one
((uptime=${uptime%\.*}+1))
instance_type=$(curl -s http://169.254.169.254/latest/meta-data/instance-type | sed -e "s#-iops##g")
#echo "INFO: Retrieving Pricing Info for: $instance_type"
url="https://pricing.vexxhost.net/v1/pricing/$instance_type/cost?seconds=$uptime"
#echo "url=$url"
json_block=$(curl -s "$url")
echo "$json_block"

set -e
echo "########## Job cost (estimate) ############"