How to get the first 100 lines of a file on S3?
<p>I have a huge (~6 GB) file on Amazon S3 and want to get the first 100 lines of it without having to download the whole thing. Is this possible?</p>

<p>Here's what I'm doing now:</p>

<pre><code>aws cp s3://foo/bar - | head -n 100
</code></pre>

<p>But this takes a while to execute. I'm confused -- shouldn't <code>head</code> close the pipe once it's read enough lines, causing <code>aws cp</code> to crash with a BrokenPipeError before it has time to download the entire file?</p>