def spot_price_history(inst_type=INSTANCE_TYPE, region='us-west-2'):
' spot price history '
now = datetime.datetime.utcnow()
start_time = '{:%Y-%m-%dT%H:00:00}'.format(now)
aws_cmd = 'aws ec2 describe-spot-price-history --start-time {} --product "Linux/UNIX" --instance-type "{}"'
aws_cmd = aws_cmd.format(start_time, inst_type)
jq_cmd = 'jq -c -C ".SpotPriceHistory[] | {SpotPrice, AvailabilityZone, InstanceType }"'
with hide("running"):
os.environ['AWS_DEFAULT_REGION'] = region
local('|'.join([aws_cmd, jq_cmd]))
评论列表
文章目录