首页 > 解决方案 > 我们可以在 boto3 中找到 AWS 实例的根卷吗?

问题描述

I need to find the volume id of root volume of my EC2 instance in boto3

I tried getting volumes by describe_volumes but there is no identifier for root volume

标签: amazon-ec2boto3

解决方案


您可以使用aws ec2 describe-instances查看附加的磁盘。卷将出现在以下BlockDeviceMappings部分:

                    "BlockDeviceMappings": [
                        {
                            "DeviceName": "/dev/xvda",
                            "Ebs": {
                                "AttachTime": "2016-01-24T06:46:06+00:00",
                                "DeleteOnTermination": true,
                                "Status": "attached",
                                "VolumeId": "vol-686feca2"
                            }
                        }
                    ],

推荐阅读