Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

download file from s3 to STDOUT

Tags:

unix

amazon-s3

I currently use s3cmd to download a file from s3. However I'd rather output the contents to STOUT. Do you know a unix tool that can do it?

Thanks, Jan

like image 559
Jan Avatar asked Nov 07 '12 15:11

Jan


People also ask

How do I download from S3 bucket to local?

You can download an object from an S3 bucket in any of the following ways: Select the object and choose Download or choose Download as from the Actions menu if you want to download the object to a specific folder. If you want to download a specific version of the object, select the Show versions button.

How do I get files from AWS S3?

In the Amazon S3 console, choose your S3 bucket, choose the file that you want to open or download, choose Actions, and then choose Open or Download. If you are downloading an object, specify where you want to save it. The procedure for saving the object depends on the browser and operating system that you are using.

Which commands can you use to print the contents of a file on S3 to your terminal screen?

Your answer All file objects must have their contents written to stdout. To get this, use the aws s3 cp command and provide "-" as the destination. $ aws s3 cp s3:/mybucket/stream.


1 Answers

You'll need to add - to the end of you command arguments to make it redirect the output to STDOUT.

Example : s3cmd get s3://... -

See this thread for more information.

You might also use the --no-progress option to avoid extra information in the output and just get the plain file content

like image 72
Mohamed AMAZIRH Avatar answered Oct 03 '22 10:10

Mohamed AMAZIRH