I’ve created AWS Lambda function to convert pdf to image.
Repository is here.
I need this function for work, but I couldn’t find any useful libraries or examples.
First, you need to install dependencies.
$ npm install gm aws-sdk util
Now, I haven’t prepared any deployment command.
You need to do it manually like this.
$ zip -r function.zip *
And, you need to upload zip at lambda console.
Of course, you must set function trigger
S3 Upload .
const srcBucket = event.Records.s3.bucket.name; const srcKey = decodeURIComponent(event.Records.s3.object.key.replace(/\+/g, " ")); const dstBucket = srcBucket; const dstKey = srcKey.replace('.pdf', '.png');
Now, destination bucket and key is same as source (extension will be
If you want to configure it, please write your own code.
Other configurations are written in README.