How can I download a file from an S3 bucket with wget?

Becks picture Becks · Aug 14, 2013 · Viewed 90.7k times · Source

I can push some content to an S3 bucket with my credentials through S3cmd tool with s3cmd put contentfile S3://test_bucket/test_file

Question is, I am required to download the content from this bucket in other computers that don't have s3cmd installed on them, BUT they have wget installed.

when I try to download some content from my bucket with wget I get this:

 https://s3.amazonaws.com/test_bucket/test_file
--2013-08-14 18:17:40--  `https`://s3.amazonaws.com/test_bucket/test_file
Resolving s3.amazonaws.com (s3.amazonaws.com)... [ip_here]
Connecting to s3.amazonaws.com (s3.amazonaws.com)|ip_here|:port... connected.
HTTP request sent, awaiting response... 403 Forbidden
`2013`-08-14 18:17:40 ERROR 403: Forbidden.

I have manually made this bucket public through the Amazon AWS web console.

Question is : How can I download content from an S3 bucket with wget? into a txt local file?

Answer

Amar picture Amar · Aug 14, 2013

You should be able to access it from a url created as follows:

http://{bucket-name}.s3.amazonaws.com/<path-to-file>

Now, say your s3 file path is:

s3://test-bucket/test-folder/test-file.txt

You should be able to wget this file with following url:

http://test-bucket.s3.amazonaws.com/test-folder/test-file.txt