How To: Download files from Amazon S3 using perl and Amazon::S3
Mar 4, 2011
After having such a hard time finding (m)any good examples online, this article is going to explain how to use perl to connect to Amazon's S3 service to download files. I am by no means a perl expert, so take the below code with a pound of salt. This example assumes that you have already a working Amazon S3 service, and the appropriate keys.
This code is used to download files which our customer's upload to our support site. The files are downloaded and stored in a directory by date (YYYYMMDD). We have a number of different users and as such only want to download the files for a specific user ($prefix).
The first thing that you will need to do is to install the Amazon::S3 CPAN module with a command similar to:
Now for the code:
If you spot any errors or have any questions, comments or feedback, please post a comment!
Kyle Johnson
A hapless technoweenie with a penchant for power lifting, heavy metal,
Linux, automation, IoT, and learning. From and living in Baltimore, MD.