如何获得AWS虚拟机(EC2)的EBS定价和磁盘信息?
我正在使用 AWS SDK 来获取我存储在本地数据库中的 EC2 虚拟机列表。在该数据库中,我还存储磁盘信息。
虚拟机有不同的可能值:“仅 EBS”、“NA”和“常规”磁盘(例如 1 x 800 NVMe SSD,我假设是 GiB?)。
我对 Azure 及其托管磁盘做了同样的事情,我想知道是否可以获得有关 Amazon 虚拟机磁盘的一些具体信息。对于 Azure,我有:
public class AzureManagedDisk
{
public string Name { get; set; }
public double IOPS { get; set; }
public string Redundancy { get; set; }
public double Size { get; set; }
public double Speed { get; set; }
}
但对于 Amazon,使用“常规”磁盘(1 x 800 NVMe SSD),我只能获取磁盘大小。有没有办法获取该磁盘的更多信息? 对于“仅限 EBS”,我查看了此处,但是当我查看时在我得到的 JSON 响应中,没有描述磁盘的内容。我尝试使用 VM sku 发出请求,但实际上我得到的是虚拟机,而不是 EBS 存储。然后,我查看了不同的服务代码,但没有看到可用于检索 EBS 产品的代码(因为我使用“AmazonEC2”来获取虚拟机),我是否错过了代码中的某些内容?
I am using AWS SDK in order to get a list of their EC2 virtual machines that I store in a local database. In that database, I also store the disks info.
The virtual machines have different possible values : "EBS Only", "NA" and a "regular" disk (such as 1 x 800 NVMe SSD, which I assume is in GiB ?).
I did the same thing for Azure and their managed disks, and I wonder if it is possible to get some specific info about Amazon virtual machines' disks. For Azure I have :
public class AzureManagedDisk
{
public string Name { get; set; }
public double IOPS { get; set; }
public string Redundancy { get; set; }
public double Size { get; set; }
public double Speed { get; set; }
}
But for Amazon, with the "regular" disks (1 x 800 NVMe SSD), I can only get the disk size. Is there a way to get more info on that disk ?
With the "EBS Only", I looked here but when I look in the JSON response I get, there is no such thing that describes the disk. I tried making a request using the VM sku, but indeed I get the virtual machine and not the EBS storage. Then, I looked to the different service codes, but I didn't see a code that could be used to retreive EBS offers (as I use "AmazonEC2" to fetch virtual machines), have I miss something in the codes ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用此AWS CLI命令。
如果EC2实例类型支持Instancestorage,则可以看到
有关当前一代实例类型的本地NVME磁盘的详细信息,您可能会看到EBS的详细信息。请注意,这些定义了EC2实例本身的属性,而不是您可能附加到实例的单个EBS卷。
您可以使用此命令
获取有关单个卷的信息,类似于您的Azure托管磁盘示例。
You may use this AWS CLI command.
If EC2 instance type supports InstanceStorage, then you can see details about local NVMe disks
For all current generation instance types, you may see EBS details. Note those define properties of the EC2 instance itself and not individual EBS volumes you may attach to the instance.
You may use this command
to get info about individual volumes similar to your Azure managed disks example.