Name
Data::Save::S3 - Zip some files to S3
Synopsis
The specified files are copied into a sub folder/zip, then moved into a zip file folder/zip.zip and uploaded to S3 using aws-cli optionally using a specified profile.
At the end of the process a zipped copy of the files will exist in the local file: folder/zip.zip and in the S3 bucket. If you do not want to keep the locally zipped copy call method clean to unlink it and remove the containing folder if it is empty.
Required software
You should install the zip command and aws-cli before using this module.
Example
use Data::Save::S3;
my $z = Data::Save::S3::new;
$z->zip = qq(DataSaveS3);
$z->add = [filePathExt(currentDirectory, qw(test c)))];
$z->s3 = qq(AppaAppsSourceVersions);
$z->send;
produces:
cd zip && zip -mqrT DataSaveS3 DataSaveS3
aws s3 cp zip/DataSaveS3.zip s3://AppaAppsSourceVersions/DataSaveS3.zip
Completed 1.8 KiB/1.8 KiB (296 Bytes/s) with 1 file(s) remaining
upload: zip/DataSaveS3.zip to s3://AppaAppsSourceVersions/DataSaveS3.zip
Description
Zip and Send to S3
Copy the named files into one folder, zip the folder and send the zip archive to S3
new
New zipper.
files :lvalue
Array of files to zip and send to S3
folder :lvalue
Folder in which to build the zip file - defaults to zip/
profile :lvalue
Optional aws-cli profile to use.
s3 :lvalue
Bucket/folder on S3 into which to upload the zip file, without the leading s3:// or trailing zip file name.
zip :lvalue
The short name of the zip file minus the zip extension and path.
send
Zip and send files to S3
1 $zip Zipper
clean
Remove local copy.
1 $zip Zipper
checkEnv
Check environment.
This is a private method.
Index
Installation
This module is written in 100% Pure Perl and, thus, it is easy to read, use, modify and install.
Standard Module::Build process for building and installing modules:
perl Build.PL
./Build
./Build test
./Build install
Author
Copyright
Copyright (c) 2016-2017 Philip R Brenan.
This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.