Hi Everyone!
I have a requirement to upload multiple files to AWS S3 (basically bulk upload), how can I do that?
Right now I am able to upload one file at a time.
Please advice.
Thanks in advance.
Hi Everyone!
I have a requirement to upload multiple files to AWS S3 (basically bulk upload), how can I do that?
Right now I am able to upload one file at a time.
Please advice.
Thanks in advance.
As far as I’m remember, AWS S3 itself does not support bulk file upload. Thus, doing bulk uploads from a k6 script, would consist in essentially doing a for loop over an array of resources, and perform a putObject
operation. You could for instance abstract this in a dedicated bulkPutObject
function of your own for instance.
It’s possible that there exists a AWS-based solution that I’m not aware of though, if there is, please feel free to direct me to resources about it.
Hope that’s helpful, and let me know if I can be of further assistance
Hi @oleiade - Thanks for the response! I wanted to basically do concurrent uploads to AWS S3 via K6.
My requirement is to do load testing of multiple files in parallel to S3 from local. I am sure that AWS CLI supports concurrent uploads to S3.
To my knowledge, there is no trivial way to do that at the moment within k6 scripts.
However, since few versions, we do support asynchronous code, and the last version introduced the async/await
syntax, which opens the door to making the AWS jslib asynchronous. We have it in mind to move the library’s API to asynchronous behavior, but it is unfortunately not planned yet.
Maybe you could explore this workaround: wrap your calls to S3 in an async function which returns a promise from the result of using the S3Client
, and at the top-level, where you wish to do your bulk upload, use something along the lines of a Promise.all()
on all those promises you instantiated? I haven’t tried it myself but I can imagine this could take you a step further?
Let me know if that’s helpful, and if you need assistance