Using boto, I was able to download just a subset of a file from Amazon s3. Given an s3 key, I specified the start and stop bytes and passed them into the get_contents_as_string call.
# Define bytes to focus on
headers={'Range' : 'bytes={}-{}'.format(start_byte, stop_byte)}
resp = key.get_contents_as_string(headers=headers)
Is there a way to accomplish the same task in boto3?
You can use the same Range parameter in get_object() method:
s3 = boto3.client('s3')
resp = s3.get_object(Bucket='bucket', Range='bytes={}-{}'.format(start_byte, stop_byte))
content = resp['Body']