Skip to content

Latest commit

 

History

History
42 lines (27 loc) · 1.85 KB

File metadata and controls

42 lines (27 loc) · 1.85 KB

Part1: Node.js environment

Cloud9 node.js setup here We will use node.js 8.10 because AWS lambda version because of async

  • command -v nvm: check nvm installation
  • nvm install 8.10
  • node --version
  • npm install aws-sdk

Important

Cloud9 terminal shell will get error The security token included in the request is invalid. for rekognition-nodejs but s3 don't. Please add the following information in ~/.bashrc. Please reference cloud9 trouble shooting here

export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
export AWS_DEFAULT_REGION=

Notes

Cloud9 defeault is use nodejs 6. When you turn on new terminal, you need to run nvm install 8.10. You get the following benefits:

  • You can now get better performance when compared to the previous LTS version 6.x (up to 20%).
  • defining a function handler using the async/await pattern.

Part2: Rekognition Codes

You can check the code here

  • You need to use previous lab images.
  • npm install sharp

Sharp document is here. It is 4x-5x faster than GraphicsMagick (gm). Also, npm install with the Pre-compiled libvips binaries.

We leverage the node.js non-blocking (asynchronize) feature. The performance is faster than python version, especially when you have multi-faces in an image.

Refrence

  • lambda layer for sharp here
  • install gm for lambda. here