August 5, 2015

1856 words 9 mins read

Tutorial: AWS API Gateway to Lambda to DynamoDB

AmazonWebservices_Logo.svgAfter last week’s Internet Of Things hack session, I became fascinated with all the fun IoT projects and technologies there are to play with. Everything you do, requires data to go into the cloud, so I figured I’d start there. In the hack series I learned how to push data into AWS Kinesis which is amazing, however it has its disadvantages. On the flip side there is the new AWS API Gateway which I also haven’t spent much time on, so that’s a perfect thing to learn. After some tinkering, I found that while AWS API Gateway -> Lambda -> DynamoDB might sound complicated, it’s actually quite easy.

Before we get started, why API over Kinesis? First, Kinesis currently costs $0.015 per hour, per shard. You need a minimum of 1 shard, so that’s a minimum of about $11 a month. If you’re sucking in data fairly constantly, this is well worth it. However if you’re tinkering around with a test IoT device, why pay money that you don’t have to? On the flip side API Gateway is charged per million API calls. Secondarily, I like working with APIs of my own design, rather than Amazon designed APIs. It means I can build lightweight interfaces on more platforms.

We’re going to start at the “bottom” and work our way upwards, so first DynamoDB.

<td width="150px">
  <a href="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-6.58.15-PM.png"><img data-attachment-id="6093" data-permalink="https://obviate.io/2015/08/05/tutorial-aws-api-gateway-to-lambda-to-dynamodb/screen-shot-2015-08-04-at-6-58-15-pm/" data-orig-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-6.58.15-PM.png" data-orig-size="752,531" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2015-08-04 at 6.58.15 PM" data-image-description="" data-medium-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-6.58.15-PM-300x212.png" data-large-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-6.58.15-PM.png" src="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-6.58.15-PM-150x150.png" alt="Screen Shot 2015-08-04 at 6.58.15 PM" width="150" height="150" class="size-thumbnail wp-image-6093" srcset="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-6.58.15-PM-150x150.png 150w, https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-6.58.15-PM-144x144.png 144w" sizes="(max-width: 150px) 100vw, 150px" /></a>
</td>
<td>
  <a href="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.04.31-PM.png"><img data-attachment-id="6103" data-permalink="https://obviate.io/2015/08/05/tutorial-aws-api-gateway-to-lambda-to-dynamodb/screen-shot-2015-08-04-at-7-04-31-pm/" data-orig-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.04.31-PM.png" data-orig-size="930,681" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2015-08-04 at 7.04.31 PM" data-image-description="" data-medium-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.04.31-PM-300x220.png" data-large-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.04.31-PM.png" src="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.04.31-PM-150x150.png" alt="Screen Shot 2015-08-04 at 7.04.31 PM" width="150" height="150" class="alignnone size-thumbnail wp-image-6103" srcset="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.04.31-PM-150x150.png 150w, https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.04.31-PM-144x144.png 144w" sizes="(max-width: 150px) 100vw, 150px" /></a>
</td>
<td>
  <a href="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.04.44-PM.png"><img data-attachment-id="6102" data-permalink="https://obviate.io/2015/08/05/tutorial-aws-api-gateway-to-lambda-to-dynamodb/screen-shot-2015-08-04-at-7-04-44-pm/" data-orig-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.04.44-PM.png" data-orig-size="850,673" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2015-08-04 at 7.04.44 PM" data-image-description="" data-medium-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.04.44-PM-300x238.png" data-large-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.04.44-PM.png" src="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.04.44-PM-150x150.png" alt="Screen Shot 2015-08-04 at 7.04.44 PM" width="150" height="150" class="alignnone size-thumbnail wp-image-6102" srcset="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.04.44-PM-150x150.png 150w, https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.04.44-PM-144x144.png 144w" sizes="(max-width: 150px) 100vw, 150px" /></a>
</td>
<td>
  <a href="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.07.04-PM.png"><img data-attachment-id="6101" data-permalink="https://obviate.io/2015/08/05/tutorial-aws-api-gateway-to-lambda-to-dynamodb/screen-shot-2015-08-04-at-7-07-04-pm/" data-orig-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.07.04-PM.png" data-orig-size="753,584" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2015-08-04 at 7.07.04 PM" data-image-description="" data-medium-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.07.04-PM-300x233.png" data-large-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.07.04-PM.png" src="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.07.04-PM-150x150.png" alt="Screen Shot 2015-08-04 at 7.07.04 PM" width="150" height="150" class="alignnone size-thumbnail wp-image-6101" srcset="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.07.04-PM-150x150.png 150w, https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.07.04-PM-144x144.png 144w" sizes="(max-width: 150px) 100vw, 150px" /></a>
</td>
<td>
  <a href="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.07.10-PM.png"><img data-attachment-id="6100" data-permalink="https://obviate.io/2015/08/05/tutorial-aws-api-gateway-to-lambda-to-dynamodb/screen-shot-2015-08-04-at-7-07-10-pm/" data-orig-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.07.10-PM.png" data-orig-size="858,581" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2015-08-04 at 7.07.10 PM" data-image-description="" data-medium-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.07.10-PM-300x203.png" data-large-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.07.10-PM.png" src="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.07.10-PM-150x150.png" alt="Screen Shot 2015-08-04 at 7.07.10 PM" width="150" height="150" class="alignnone size-thumbnail wp-image-6100" srcset="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.07.10-PM-150x150.png 150w, https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.07.10-PM-144x144.png 144w" sizes="(max-width: 150px) 100vw, 150px" /></a>
</td>
Step #1 – Create a new table.
Primary Key = Hash & Range
Hash Name = device (Type string)
Range Name = timedate (Type number)
Step #2 – Skip the global indexes.
We don’t need them for our small test.
Step #3 – Provision Throughput.
I went with 5 read, 2 write. This costs ~$1.46 a month.
Step #4 – Turn on alarms
Step #5 – Create!

With that DynamoDB is done and will create itself shortly. Since it’s a NoSQL database, we don’t need to worry about the data going into it at all. So the next step is creating our Lambda function which will take the API call data and push it into DynamoDB.

<td width="150px">
  <a href="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.20.41-PM.png"><img data-attachment-id="6107" data-permalink="https://obviate.io/2015/08/05/tutorial-aws-api-gateway-to-lambda-to-dynamodb/screen-shot-2015-08-04-at-7-20-41-pm/" data-orig-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.20.41-PM.png" data-orig-size="1074,645" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2015-08-04 at 7.20.41 PM" data-image-description="" data-medium-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.20.41-PM-300x180.png" data-large-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.20.41-PM-1024x615.png" src="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.20.41-PM-150x150.png" alt="Screen Shot 2015-08-04 at 7.20.41 PM" width="150" height="150" class="alignnone size-thumbnail wp-image-6107" srcset="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.20.41-PM-150x150.png 150w, https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.20.41-PM-144x144.png 144w" sizes="(max-width: 150px) 100vw, 150px" /></a>
</td>
<td>
  <a href="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.25.17-PM.png"><img data-attachment-id="6108" data-permalink="https://obviate.io/2015/08/05/tutorial-aws-api-gateway-to-lambda-to-dynamodb/screen-shot-2015-08-04-at-7-25-17-pm/" data-orig-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.25.17-PM.png" data-orig-size="955,421" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2015-08-04 at 7.25.17 PM" data-image-description="" data-medium-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.25.17-PM-300x132.png" data-large-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.25.17-PM.png" src="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.25.17-PM-150x150.png" alt="Screen Shot 2015-08-04 at 7.25.17 PM" width="150" height="150" class="alignnone size-thumbnail wp-image-6108" srcset="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.25.17-PM-150x150.png 150w, https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.25.17-PM-144x144.png 144w" sizes="(max-width: 150px) 100vw, 150px" /></a>
</td>
<td>
  <a href="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.27.30-PM.png"><img data-attachment-id="6109" data-permalink="https://obviate.io/2015/08/05/tutorial-aws-api-gateway-to-lambda-to-dynamodb/screen-shot-2015-08-04-at-7-27-30-pm/" data-orig-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.27.30-PM.png" data-orig-size="1243,580" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2015-08-04 at 7.27.30 PM" data-image-description="" data-medium-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.27.30-PM-300x140.png" data-large-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.27.30-PM-1024x478.png" src="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.27.30-PM-150x150.png" alt="Screen Shot 2015-08-04 at 7.27.30 PM" width="150" height="150" class="alignnone size-thumbnail wp-image-6109" srcset="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.27.30-PM-150x150.png 150w, https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.27.30-PM-144x144.png 144w" sizes="(max-width: 150px) 100vw, 150px" /></a>
</td>

<td>
  <a href="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.35.59-PM.png"><img data-attachment-id="6110" data-permalink="https://obviate.io/2015/08/05/tutorial-aws-api-gateway-to-lambda-to-dynamodb/screen-shot-2015-08-04-at-7-35-59-pm/" data-orig-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.35.59-PM.png" data-orig-size="1120,695" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2015-08-04 at 7.35.59 PM" data-image-description="" data-medium-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.35.59-PM-300x186.png" data-large-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.35.59-PM-1024x635.png" src="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.35.59-PM-150x150.png" alt="Screen Shot 2015-08-04 at 7.35.59 PM" width="150" height="150" class="alignnone size-thumbnail wp-image-6110" srcset="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.35.59-PM-150x150.png 150w, https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.35.59-PM-144x144.png 144w" sizes="(max-width: 150px) 100vw, 150px" /></a>
</td>
<td>
  <a href="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.36.40-PM.png"><img data-attachment-id="6111" data-permalink="https://obviate.io/2015/08/05/tutorial-aws-api-gateway-to-lambda-to-dynamodb/screen-shot-2015-08-04-at-7-36-40-pm/" data-orig-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.36.40-PM.png" data-orig-size="1372,447" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2015-08-04 at 7.36.40 PM" data-image-description="" data-medium-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.36.40-PM-300x98.png" data-large-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.36.40-PM-1024x334.png" src="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.36.40-PM-150x150.png" alt="Screen Shot 2015-08-04 at 7.36.40 PM" width="150" height="150" class="alignnone size-thumbnail wp-image-6111" srcset="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.36.40-PM-150x150.png 150w, https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.36.40-PM-144x144.png 144w" sizes="(max-width: 150px) 100vw, 150px" /></a>
</td>
Step #1 – Create a new Lambda function.
Skip the “blueprint”
Name = OurBlogLambda
Runtime = Node.JS
Get the code from this gist.
Step #2 – The rest of the Lambda answers.
Handler = index.handler (that’s the default)
Role = Select “Basic with DynamoDB”, this will spawn a new window to walk you through and create a new IAM role. When you’re done, you should have a role named something like “lambda_dynamo”.
Leave the advanced settings alone.
Step #3 – Review and create Lambda function.
Step #4 – Test.
Click the test button and paste in the following JSON:

  <pre class="prettyprint">{

“device”: “test”, “lat”: “-1.1”, “lon”: “2.2” }

Step #5 – If everything went well, you’ll have a “SUCCESS”
If you want, you can also go check DynamoDB and you should see a record in your database now.

With that, you’ve completed the Lambda setup process. As you should have been able to figure out, our data of choice to be submitted is latitude & longitude. You can very easily change this Lambda function to be any sort of data type and/or names. You can also add/subtract the number of items being submitted to Dynamo, in this function, at any time. So with everything working, now we move on to the API Gateway.

<td width="150px">
  <a href="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.45.40-PM.png"><img data-attachment-id="6120" data-permalink="https://obviate.io/2015/08/05/tutorial-aws-api-gateway-to-lambda-to-dynamodb/screen-shot-2015-08-04-at-7-45-40-pm/" data-orig-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.45.40-PM.png" data-orig-size="1030,358" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2015-08-04 at 7.45.40 PM" data-image-description="" data-medium-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.45.40-PM-300x104.png" data-large-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.45.40-PM-1024x356.png" src="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.45.40-PM-150x150.png" alt="Screen Shot 2015-08-04 at 7.45.40 PM" width="150" height="150" class="alignnone size-thumbnail wp-image-6120" srcset="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.45.40-PM-150x150.png 150w, https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-04-at-7.45.40-PM-144x144.png 144w" sizes="(max-width: 150px) 100vw, 150px" /></a>
</td>
<td>
  <a href="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-11.58.06-AM.png"><img data-attachment-id="6122" data-permalink="https://obviate.io/2015/08/05/tutorial-aws-api-gateway-to-lambda-to-dynamodb/screen-shot-2015-08-05-at-11-58-06-am/" data-orig-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-11.58.06-AM.png" data-orig-size="340,278" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2015-08-05 at 11.58.06 AM" data-image-description="" data-medium-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-11.58.06-AM-300x245.png" data-large-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-11.58.06-AM.png" src="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-11.58.06-AM-150x150.png" alt="Screen Shot 2015-08-05 at 11.58.06 AM" width="150" height="150" class="alignnone size-thumbnail wp-image-6122" srcset="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-11.58.06-AM-150x150.png 150w, https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-11.58.06-AM-144x144.png 144w" sizes="(max-width: 150px) 100vw, 150px" /></a>
</td>
<td>
  <a href="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-11.59.46-AM.png"><img data-attachment-id="6123" data-permalink="https://obviate.io/2015/08/05/tutorial-aws-api-gateway-to-lambda-to-dynamodb/screen-shot-2015-08-05-at-11-59-46-am/" data-orig-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-11.59.46-AM.png" data-orig-size="1069,364" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2015-08-05 at 11.59.46 AM" data-image-description="" data-medium-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-11.59.46-AM-300x102.png" data-large-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-11.59.46-AM-1024x349.png" src="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-11.59.46-AM-150x150.png" alt="Screen Shot 2015-08-05 at 11.59.46 AM" width="150" height="150" class="alignnone size-thumbnail wp-image-6123" srcset="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-11.59.46-AM-150x150.png 150w, https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-11.59.46-AM-144x144.png 144w" sizes="(max-width: 150px) 100vw, 150px" /></a>
</td>
<td>
  <a href="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.01.22-PM.png"><img data-attachment-id="6124" data-permalink="https://obviate.io/2015/08/05/tutorial-aws-api-gateway-to-lambda-to-dynamodb/screen-shot-2015-08-05-at-12-01-22-pm/" data-orig-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.01.22-PM.png" data-orig-size="614,255" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2015-08-05 at 12.01.22 PM" data-image-description="" data-medium-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.01.22-PM-300x125.png" data-large-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.01.22-PM.png" src="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.01.22-PM-150x150.png" alt="Screen Shot 2015-08-05 at 12.01.22 PM" width="150" height="150" class="alignnone size-thumbnail wp-image-6124" srcset="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.01.22-PM-150x150.png 150w, https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.01.22-PM-144x144.png 144w" sizes="(max-width: 150px) 100vw, 150px" /></a>
</td>
<td>
  <a href="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.02.38-PM.png"><img data-attachment-id="6125" data-permalink="https://obviate.io/2015/08/05/tutorial-aws-api-gateway-to-lambda-to-dynamodb/screen-shot-2015-08-05-at-12-02-38-pm/" data-orig-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.02.38-PM.png" data-orig-size="1061,531" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2015-08-05 at 12.02.38 PM" data-image-description="" data-medium-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.02.38-PM-300x150.png" data-large-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.02.38-PM-1024x512.png" src="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.02.38-PM-150x150.png" alt="Screen Shot 2015-08-05 at 12.02.38 PM" width="150" height="150" class="alignnone size-thumbnail wp-image-6125" srcset="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.02.38-PM-150x150.png 150w, https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.02.38-PM-144x144.png 144w" sizes="(max-width: 150px) 100vw, 150px" /></a>
</td>
Step #1 – Create a new API.
Step #2 – Create a new Resource.
We’re going to name this “submitData” since it’s taking data in (to Lambda). Later you could create more resources for getting data out.

  <p>
    <strong>Update 2016-02-29</strong> Per the comments it looks like this step is no longer required.
  </p>
</td>

<td>
  <a href="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-11.56.41-AM.png"><img data-attachment-id="6121" data-permalink="https://obviate.io/2015/08/05/tutorial-aws-api-gateway-to-lambda-to-dynamodb/screen-shot-2015-08-05-at-11-56-41-am/" data-orig-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-11.56.41-AM.png" data-orig-size="1053,398" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2015-08-05 at 11.56.41 AM" data-image-description="" data-medium-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-11.56.41-AM-300x113.png" data-large-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-11.56.41-AM-1024x387.png" src="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-11.56.41-AM-150x150.png" alt="Screen Shot 2015-08-05 at 11.56.41 AM" width="150" height="150" class="alignnone size-thumbnail wp-image-6121" srcset="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-11.56.41-AM-150x150.png 150w, https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-11.56.41-AM-144x144.png 144w" sizes="(max-width: 150px) 100vw, 150px" /></a>
</td>
Step #3 – Create a method.
We’re submitting data, so POST makes the most sense. Make sure you were still selecting your new “/submitdata” resource.
Step #4 – Setup the POST to go to Lambda.
Click “POST” under “/submitdata” to the left. We’re using a Lambda function and if you start to type the name, it should auto-fill for you.
Step #5 – Save & Accept permission change.
When you go to save your changes, AWS will confirm you want to give API Gateway permission to invoke Lambda.
Step #6 – Confirm everything looks correct.
Your “/submitdata – POST – Method Execution” should look almost identical to my screenshot.
Step #7 – Test it!
Click the test button and put the following code into the “Request body”:

  <pre class="prettyprint">{

“device”: “apitest”, “lat”: “-10.01”, “lon”: “20.02” }

  <p>
    You should see a &#8220;SUCCESS&#8221; in the response body. You can also look at DynamoDB to confirm your row is in the database.</td> 
    
    <td>
      <a href="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.06.03-PM.png"><img data-attachment-id="6126" data-permalink="https://obviate.io/2015/08/05/tutorial-aws-api-gateway-to-lambda-to-dynamodb/screen-shot-2015-08-05-at-12-06-03-pm/" data-orig-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.06.03-PM.png" data-orig-size="573,710" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2015-08-05 at 12.06.03 PM" data-image-description="" data-medium-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.06.03-PM-242x300.png" data-large-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.06.03-PM.png" src="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.06.03-PM-150x150.png" alt="Screen Shot 2015-08-05 at 12.06.03 PM" width="150" height="150" class="alignnone size-thumbnail wp-image-6126" srcset="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.06.03-PM-150x150.png 150w, https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.06.03-PM-144x144.png 144w" sizes="(max-width: 150px) 100vw, 150px" /></a>
    </td></tr> 
    
    <tr>
      <td>
        Step #8 &#8211; Deploy API.<br /> Click &#8220;Deploy API&#8221;.<br /> Deployment Stage = New Stage<br /> Stage name = testing
      </td>
      
      <td>
        <a href="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.07.08-PM.png"><img data-attachment-id="6127" data-permalink="https://obviate.io/2015/08/05/tutorial-aws-api-gateway-to-lambda-to-dynamodb/screen-shot-2015-08-05-at-12-07-08-pm/" data-orig-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.07.08-PM.png" data-orig-size="610,419" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2015-08-05 at 12.07.08 PM" data-image-description="" data-medium-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.07.08-PM-300x206.png" data-large-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.07.08-PM.png" src="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.07.08-PM-150x150.png" alt="Screen Shot 2015-08-05 at 12.07.08 PM" width="150" height="150" class="alignnone size-thumbnail wp-image-6127" srcset="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.07.08-PM-150x150.png 150w, https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.07.08-PM-144x144.png 144w" sizes="(max-width: 150px) 100vw, 150px" /></a>
      </td>
    </tr>
    
    <tr>
      <td>
        Step #9 &#8211; Get the URL.<br /> If everything saved previously you should now see &#8221; Invoke URL: https://RANDOMVALUEHERE.execute-api.us-west-2.amazonaws.com/testing &#8220;. You&#8217;re almost done!
      </td>
      
      <td>
        <a href="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.10.04-PM.png"><img data-attachment-id="6128" data-permalink="https://obviate.io/2015/08/05/tutorial-aws-api-gateway-to-lambda-to-dynamodb/screen-shot-2015-08-05-at-12-10-04-pm/" data-orig-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.10.04-PM.png" data-orig-size="1046,613" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2015-08-05 at 12.10.04 PM" data-image-description="" data-medium-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.10.04-PM-300x176.png" data-large-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.10.04-PM-1024x600.png" src="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.10.04-PM-150x150.png" alt="Screen Shot 2015-08-05 at 12.10.04 PM" width="150" height="150" class="alignnone size-thumbnail wp-image-6128" srcset="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.10.04-PM-150x150.png 150w, https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.10.04-PM-144x144.png 144w" sizes="(max-width: 150px) 100vw, 150px" /></a>
      </td>
    </tr>
    
    <tr>
      <td>
        Step #10 &#8211; Curl Test<br /> On your command line try:<br /> <code>curl -H "Content-Type: application/json" -X POST -d "{\"device\":\"curl\",\"lat\":\"12.34\",\"lon\":\"45.67\"}" https://CHANGEME.execute-api.us-west-2.amazonaws.com/testing/submitdata</code><br /> (make sure that the URL matches that which you got in the previous step).</p> 
        
        <p>
          You should see &#8220;SUCCESS&#8221;, and be able to see your data in DynamoDB.</td> 
          
          <td>
            <a href="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.13.37-PM.png"><img data-attachment-id="6129" data-permalink="https://obviate.io/2015/08/05/tutorial-aws-api-gateway-to-lambda-to-dynamodb/screen-shot-2015-08-05-at-12-13-37-pm/" data-orig-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.13.37-PM.png" data-orig-size="602,404" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Screen Shot 2015-08-05 at 12.13.37 PM" data-image-description="" data-medium-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.13.37-PM-300x201.png" data-large-file="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.13.37-PM.png" src="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.13.37-PM-150x150.png" alt="Screen Shot 2015-08-05 at 12.13.37 PM" width="150" height="150" class="alignnone size-thumbnail wp-image-6129" srcset="https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.13.37-PM-150x150.png 150w, https://obviate.io/wp-content/uploads/2015/08/Screen-Shot-2015-08-05-at-12.13.37-PM-144x144.png 144w" sizes="(max-width: 150px) 100vw, 150px" /></a>
          </td></tr> </table> 
          
          <p>
            <a href="https://obviate.io/wp-content/uploads/2015/08/reinvent_launch-page_illustration_lambda.png"><img data-attachment-id="6158" data-permalink="https://obviate.io/2015/08/05/tutorial-aws-api-gateway-to-lambda-to-dynamodb/reinvent_launch-page_illustration_lambda/" data-orig-file="https://obviate.io/wp-content/uploads/2015/08/reinvent_launch-page_illustration_lambda.png" data-orig-size="200,201" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="reinvent_launch-page_illustration_lambda" data-image-description="" data-medium-file="https://obviate.io/wp-content/uploads/2015/08/reinvent_launch-page_illustration_lambda.png" data-large-file="https://obviate.io/wp-content/uploads/2015/08/reinvent_launch-page_illustration_lambda.png" src="https://obviate.io/wp-content/uploads/2015/08/reinvent_launch-page_illustration_lambda.png" alt="reinvent_launch-page_illustration_lambda" width="200" height="201" class="alignleft size-full wp-image-6158" srcset="https://obviate.io/wp-content/uploads/2015/08/reinvent_launch-page_illustration_lambda.png 200w, https://obviate.io/wp-content/uploads/2015/08/reinvent_launch-page_illustration_lambda-150x150.png 150w, https://obviate.io/wp-content/uploads/2015/08/reinvent_launch-page_illustration_lambda-144x144.png 144w" sizes="(max-width: 200px) 100vw, 200px" /></a> Congratulations, you&#8217;re all done! You can now accept data POST&#8217;ed to a REST API, fed into Lambda, and stored in DynamoDB. One caveat for you IoT people reading this tutorial though, <u>AWS API Gateway is HTTPS ONLY</u>. Unfortunately it doesn&#8217;t not operate on regular unencrypted HTTP. So if you&#8217;re trying to submit data directly from an Arduino, you&#8217;re out of luck. You&#8217;ll need to use a headend with more CPU power to submit to API Gateway.
          </p>
          
          <p>
            Now take this skeleton and get fancy with it. Are you accepting data in one format (ex: Degrees centigrade) and need it in another (ex: Fahrenheit)? Rather than doing that in your device, Lambda can do the conversion before storage. In fact, Lambda can do a ton more (e.g. store data in S3, Launch EC2 instances, fire off messages in SNS), it can do basically anything the <a href="https://aws.amazon.com/sdk-for-node-js/">AWS SDK for NodeJS</a> can do.
          </p>