Boto3 get EC2 instance's volume

前端 未结 5 560
既然无缘
既然无缘 2021-01-14 10:00

I am trying to get volume-id list of aws instance using boto 3, I am getting sort of collection manager but I don\'t know how to get the data inside.

import          


        
5条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-14 10:24

    Using an EC2 client:

    ec2_client = boto3.client('ec2',
                        aws_access_key_id='XYZ',
                        aws_secret_access_key='XYZ',
                        region_name='us-east-1')
    volumes = ec2_client.describe_instance_attribute(InstanceId='i-0b30bea4e05579def',
    Attribute='blockDeviceMapping')
    

提交回复
热议问题