I am trying to get a list of all the EBS volumes in an AWS account. I'm using Python 3 and boto3 version 1.10.34.
I found this post with some suggestions but neither of them work.
I'm setting the ec2_client
like this:
import boto3
session = boto3.Session(profile_name=aws_account,region_name='us-east-1')
ec2_client = session.client('ec2')
If I try volumes = ec2_client.volumes.all()
I get back AttributeError: 'EC2' object has no attribute 'volumes'
.
If I try volumes = ec2_client.get_all_volumes()
I get back AttributeError: 'EC2' object has no attribute 'get_all_volumes'
.
How can I do this correctly?