Serverless Image Handler
Serverless Image Handler

Appendix I: Customizing Thumbor Lambda package

Use the following procedure to make customizations to the Thumbor Lambda package:

Note that it is recommend to build the application binary on Amazon Linux.

  1. Setup your OS/Python Environment:

    $ yum install yum-utils epel-release -y $ sudo yum-config-manager --enable epel $ sudo yum update -y $ sudo yum install zip wget git libpng-devel libcurl-devel gcc python-devel libjpeg-devel -y $ alias sudo='sudo env PATH=$PATH' $ sudo pip install setuptools==39.0.1 $ sudo pip install virtualenv==15.2.0
  2. Clone the github repo:

    $ git clone https://github.com/awslabs/serverless-image-handler.git
  3. Navigate to the deployment folder:

    $ cd serverless-image-handler/deployment
  4. Run ./build-s3-dist.sh <bucket-name> <version>:

    $ ./build-s3-dist.sh mybucket v1.0

    Note that the <bucket-name> should be the name for the Amazon S3 bucket location where the template will source the Lambda code. The template will append -[region_name] as the value. In the above example, the solution template will expect the source code to be located in the mybucket-[region_name] bucket: serverless-image-handler/v1.0/serverless-image-handler.zip

  5. Navigate to the deployment/dist folder and upload the solution artifacts to the Amazon S3 bucket:

    $ aws s3 cp . s3://mybucket-[region_name]/serverless-image-handler/v1.0/ --recursive --exclude "*" --include "*.zip" $ aws s3 cp serverless-image-handler.template s3:// mybucket-[region_name]/serverless-image-handler/v1.0/
  6. Upload the AWS CloudFormation solution template to deploy the updated solution assets.