Solution

This is the solution we are going to implement

  1. Upload the photo of a celebrity.

  2. Binary data is POSTed to API Gateway.

  3. API Gateway passes the data to Lambda (base64-encoded).

  4. Lambda converts it back to binary and invokes RecognizeCelebrities.

  5. Name and Confidence are returned back to the client.

And these are the main steps to implement it

  1. Create the Lambda role in IAM with these two Managed Policies: AWSLambdaBasicExecutionRole and AmazonRekognitionFullAccess.

  2. Create the Lambda function in a language of your choice.

  3. Create API Gateway API with a POST method and attach Lambda to it.

    • Remember: Content-Type will be image/jpeg.
    • Don't forget to enable binary support and CORS.
    • Mapping template is: {"picture": "$input.body"}
  4. Update the HTML page 'celebrity.html' with your API URL and test.


Extra challenges for the savvy

coming soon...