Skip to content

Latest commit

 

History

History
55 lines (46 loc) · 4.54 KB

aws_setup.md

File metadata and controls

55 lines (46 loc) · 4.54 KB

Setup: AWS

First of all, log into AWS, or create an AWS account if you don't have one yet.

The settings must be made in the "EU (Ireland)" region (or any other region that supports Alexa skills - but currently not too many regions support Alexa skills).

S3 Setup

  • Go to S3
  • Set up a new bucket using a name such as "smartcam123", and remember this bucket name for later on. No special settings must be made, just create the bucket.

Lambda Setup

API Gateway Setup

  • Go to API Gateway
  • Create a new API, give it any name. (A sample swagger schema can be seen here)
  • Create two new resources: smartcamIdentifyPerson and smartcamTagPerson
  • For each of the two resources, create two new methods. Type "ANY".
  • Configure them as "Lambda Function" and enable "Use Lambda Proxy integration"
  • Select your Lambda region (previous setup, should be EU (Ireland) most likely) and enter the ARN of the two lambda functions you created, respectively matching the name.
  • In the "Settings" tab of your API, in the "Binary Media Types" section enter "image/jpeg"
  • Now go into the main API screen again and from the "Actions" dropdown select "Deploy API". Deploy to "production".
  • Now go into the "Stages" section and select the prod API. Write down the "Invoke URL" , it will look something like this: https://w12312331.execute-api.eu-central-1.amazonaws.com/prod

CloudFront Setup

As Arduino does not properly support HTTPS connections, we must set up a "proxy" server that is available via HTTP and forwards requests to our HTTPS-only API Gateway endpoint.

  • Go to CloudFront
  • Set up a new CloudFront distribution, with the settings described here.
  • For the "Origin" field, enter the hostname you figured out as the "Invoke URL" in the last step of the previous "API Gateway" step, for example: w12312331.execute-api.eu-central-1.amazonaws.com
  • Save the CloudFront Distribution and wait for it to be distributed. Via CloudFront, our API we created in API Gateway can be called from HTTP (from the Arduino) now
  • Write down the hostname of the CloudFront distribution you created, for example: d123x23x23.cloudfront.net

Update Lambda Function, Arduino code

Now that we set up the CloudFront distribution, we must enter the URL to call our API into the Arduino code (so it can upload the image) as well as update the "smartcamAlexa" lambda function you created, so it can tag faces.

  • Open the Arduino Code and look for: response += "Host: d123x23x23.cloudfront.net\r\n"; Replace the hostname (d123x23x23.cloudfront.net) with the hostname of YOUR CloudFront distribution.
  • Upload the sketch to your Arduino. Don't forget to update the IP settings, etc.
  • Open the "smartcamAlexa" lambda function and look for: lambdaUrl = 'http://d123123123v.cloudfront.net/prod/smartcamTagPerson' Again, replace the hostname (d123x23x23.cloudfront.net) with the hostname of YOUR CloudFront distribution.
  • Save the lambda function

AWS Rekognition Setup

Luckily, AWS Rekognition does not require any setup. ;-)

Now, proceed setting up the Alexa Skill.