如何获取正在运行的EC2竞价型实例的价格? [英] How to get the price of a running EC2 spot instance?

查看:72
本文介绍了如何获取正在运行的EC2竞价型实例的价格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用boto3 api创建ec2竞价型实例,到目前为止,我能够获得竞价型实例的历史价格,启动竞价型实例等.

I am trying to create ec2 spot instances using boto3 api, so far I am able to get the spot instance history price, spin up a spot instance, etc.

但是我不知道如何使用boto api获得我们为竞价型实例支付的价格.

But I don't know how to get the price we are paying for spot instance using boto api.

有人知道该怎么做吗?

谢谢

推荐答案

更新:请参阅: 旧答案:

在Amazon EC2下启动竞价型实例时,您指定最高每小时价格,称为 bid .这是实例要收取的最高价格.

When launching a spot instance under Amazon EC2, you specify a maximum hourly price, known as a bid. This is the maximum price that will be charged for the instance.

启动实例时,在实例处于运行状态的每个小时周年纪念日,实例将按当时的现货价格收费.

When the instance is launched, and on each hourly anniversary of the instance being in a running state, the instance will be charged at the then-current spot price.

如果某个实例是由于现货价格上涨到高于买入价而终止的,则该实例终止的部分小时不收取任何费用.但是,如果用户终止竞价型实例,则将按不足的时间 收费.

If an instance is terminated due to the spot price rising above the bid price, then there is no charge for the partial hour where the instance was terminated. However, if the user terminates a spot instance, the partial hour will be charged.

因此,我们为竞价实例支付的价格"是每小时开始时的价格.它是在收费时计算的.

Therefore, "the price we are paying for spot instance" is the price at the start of each hour. It is calculated at the time that the charge takes place.

要获取竞价型实例的价格,请使用 竞价型实例数据馈送 ,该数据馈送描述了您的竞价型实例的使用情况和价格.该数据订阅源将发送到您在订阅数据订阅源时指定的Amazon S3存储桶.它每小时更新一次.

To obtain the price charged for a spot instance, use the Spot Instance Data Feed that provides a data feed that describes your Spot Instance usage and pricing. This data feed is sent to an Amazon S3 bucket that you specify when you subscribe to the data feed. It is updated hourly.

这篇关于如何获取正在运行的EC2竞价型实例的价格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆