I have an ec2 instance where a approx. 400 GB file (tar.gz) is stored.
I now want to unzip and upload that file and store it inside a s3 bucket which is in the same aws account.
Regarding the normal aws s3 cp command i always ran into timeouts.
What is the easiest way to accomplish that task
2
Answers
I would recommend using
s3 sync
instead ofs3 cp
.They sync should possibly work. In general, the underlying mechanics is probably built on multi-part upload. That may be useful to know if you want to implement it yourself. It can be done even from command line.
https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpu-upload-object.html
The process may look intimidating, but it is not that bad and the benefit is that you can upload a large file even over a bad line, because you can re-try individual parts. You can also finish the upload later – for example after your temporary permissions do expire or the next day. Or possibly you can upload from two locations as long as the file is split the exact same way.
Initiate the upload:
Upload part:
Complete multi-part:
The mpstruct is:
the structure can be obtained also from the
list-multipart-uploads
command.