如何检测EBS卷类型?

时间:2016-09-09 23:37:53

标签: amazon-web-services amazon-s3 amazon-ec2 aws-sdk

是否可以检测连接的EBS卷是使用GP2(SSD)还是配置IOPS(io2)?

我是否可以发出一个简单的curl命令来检测附加到我的实例的内容?我在实例上我想要运行此命令。

我也想在不需要AWS凭证的情况下这样做

1 个答案:

答案 0 :(得分:1)

没有curl命令可以让您知道卷类型是什么。您将通过控制台检查。或者另一种方法是使用AWS CLI命令。如果不使用AWS Credentials,也是不可能的。

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-describing-volumes.html

使用CLI命令。

aws ec2 describe-volumes

示例输出

{
    "Volumes": [
        {
            "AvailabilityZone": "us-east-1a",
            "Attachments": [
                {
                    "AttachTime": "2013-12-18T22:35:00.000Z",
                    "InstanceId": "i-1234567890abcdef0",
                    "VolumeId": "vol-049df61146c4d7901",
                    "State": "attached",
                    "DeleteOnTermination": true,
                    "Device": "/dev/sda1"
                }
            ],
            "VolumeType": "standard",
            "VolumeId": "vol-049df61146c4d7901",
            "State": "in-use",
            "SnapshotId": "snap-1234567890abcdef0",
            "CreateTime": "2013-12-18T22:35:00.084Z",
            "Size": 8
        },
        {
            "AvailabilityZone": "us-east-1a",
            "Attachments": [],
            "VolumeType": "io1",
            "VolumeId": "vol-1234567890abcdef0",
            "State": "available",
            "Iops": 1000,
            "SnapshotId": null,
            "CreateTime": "2014-02-27T00:02:41.791Z",
            "Size": 100
        }
    ]
}