We used this application to download all the files from an S3 Bucket and then resize and migrate them to another S3 Bucket.
Having around 500 bulk images in S3 bucket and the web app performace was affected. It was required to create two versions for each image, one with 1024 pixels wide and another with 512 pixels wide (for thumbnails). And all the images should be organized properly and migrated to another S3 bucket.
- Download all the images from the existing S3 Bucket (local folder)
- For Each image downloaded,
- Upload the original image to the new S3 with a folder key (original/)
- Resize the original image to 1024pixels - This was done using sharp for NodeJS.
- Upload the resized image to the new S3 with a folder key (large/)
- Resize the original image to 512pixels using sharp
- Upload the original image to the new S3 with a folder key (small/)
- NodeJS
- AWS JS SDK
- Sharp
- request and fs
AWS.config.update({ accessKeyId: 'YOUR KEY', secretAccessKey: 'YOUR KEY' });
var s3URL = 'https://S3 URL.amazonaws.com/';
var bucketName = 'BUCKET NAME';
Fork and customize to achieve the required task.