A simple Rust binary to unzip an S3 archive into S3's root directory.
Works without downloading the archive or putting it into RAM, so will unzip a huge dataset
archive even if run on t2.micro(restrictions apply).
Download x86_64 Linux Binary
- Works without downloading the archive or putting it into RAM, so will unzip a huge dataset
archive even if run on
t2.micro
- The only condition for it to work currently is that your machine has more RAM then the largest archive's file.
- If you want to add streaming the files directly to S3 as they get unzipped you can make a PR, we will be very thankful for that!
- May not work with archives generated with macos archiver. Guaranteed to work with archives produced from
zip.
s3-unzip -v -r [region_name] -p [prefix_name] <bucket_name> <zip_name>
-vturns on verbose mode. Prints the files to the stdout as they unpack- pass
-r [region_name]to specify region name.us-east-1by default. - pass
-p [prefix_name]to prefix all unpacked S3 object keys with a value. This evvectively puts the unpacked files into a folder is you specify something like-p path/to/folder/ - specify
<bucket_name>and<zip_name>to find the archive.
For the program to find your credentials, aws configure them with the aws-cli client on your machine.
Note that those must have access to your bucket or global access.
If you want to cross-compile this to your EC2 instance from a macOS host, you might try these steps (linker installation procedure may differ in your case):
- Add the new target using rustup:
rustup target add x86_64-unknown-linux-gnu - Install the cross-platform linker using
brew:brew tap SergioBenitez/osxct && brew install x86_64-unknown-linux-gnu - Compile using a custom linker:
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-linux-gnu-gcc cargo build --target=x86_64-unknown-linux-gnu --release. - Your binary is now in
target/x86_64-unknown-linux-gnu/release/s3-unzip. You might want to copy it to the server usingscpand usescreen -d -m <command>to execute it in the background (seescreendocs for details).
This package is not lambda-compatible since lambda limits the execution time to 15 minutes. If you want to make it compatible, though, feel free to make a PR.