Using the ffmpeg command, we can resize the images using the specified pixels. Below are the lambda functions used to convert images using the lambda function. ============= import os import subprocess import shlex import boto3 import json import urllib.parse from time import sleep S3_DESTINATION_BUCKET = "s3-bucket-name" SIGNED_URL_TIMEOUT = 600 def lambda_handler ( event , context ): os.chdir( '/tmp' ) s3_source_bucket = event[ 'Records' ][ 0 ][ 's3' ][ 'bucket' ][ 'name' ] s3_source_key = urllib.parse.unquote_plus(event[ 'Records' ][ 0 ][ 's3' ][ 'object' ][ 'key' ], encoding = 'utf-8' ) s3_source_basename = os.path.splitext(os.path.basename(s3_source_key))[ 0 ] s3_source_key_new = os.path.basename(s3_source_key) s3_destination_filename_xlarge = "xlarge" +s3_source_key_new s3_destination_filename_large = "large" +s3_source_key_new s3_