GithubHelp home page GithubHelp logo

jaimesangcap / cloudconvert-aws-lambda-sample Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cloudconvert/cloudconvert-aws-lambda-sample

0.0 1.0 0.0 539 KB

AWS Lambda Example Function for the CloudConvert API

Home Page: https://cloudconvert.com

JavaScript 100.00%

cloudconvert-aws-lambda-sample's Introduction

AWS Lambda Example Function for the CloudConvert API

AWS Lambda is an event-driven compute service which runs your code (Lambda functions) in response to events, such as changes to data in an Amazon S3 bucket. In combination with the CloudConvert API it is possible to automatically convert all files, added to a specific S3 bucket, to an output format.

This repository provides an example for such an Lambda function (convert.js). It can easily be adjusted and extended to specific use cases.

Setup Instructions

  • Download / Fork this repository
  • Run npm install
  • Adjust convert.js according to your needs:
    • Set CLUDCONVERT_API_KEY to your personal API key.
    • Set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY for downloading and uploading from/to your S3 bucket.
    • Adjust the conversion paramaters, such as outputformat according to your need. All possible options can be identified using the API Console.
  • Create a ZIP file which contains convert.js and the node_modules folder.
  • In the AWS Console create a new Lambda function. Select Blank Function blueprint.
  • Select S3 trigger and your bucket. Set Event Type to PUT. Adjust Prefix and Suffix to trigger for specific files only. Lambda trigger configuration
  • Choose a name for your Lambda function and use Node.js 4.3 as Runtime. Upload your previously created ZIP file as Lambda function. The Handler name needs to be convert.handler. The lambda function does not need any specific permissions: you can create a new empty role. Lambda function configuration
  • A timeout value of 10 seconds should be sufficient. Please note that the lambda function only triggers the actual conversion and terminates as soon as the conversion was started. Therefore the timeout does not affect the time needed for the actual conversion.
  • Done! You can test your Lambda function by adding a new file to your S3 bucket.

Resources

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.