Trying to list all the snapshots present in a region using boto3, but not able to list more than 1000. Is there a workaround for this to list all the ebs snapshots?
def ebssnapsot(aws_id):
response = ec2_client.describe_snapshots(
MaxResults=100000,
)
print(json.dumps(response, indent=2, default=str))
CodePudding user response:
You have to paginate through multiple requests to get all the values. You can either do this yourself via the NextToken
parameter in the describe_snapshots()
call, or you can use the built-in paginator.