This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('Loading event'); | |
var AWS = require('aws-sdk'); | |
var dynamodb = new AWS.DynamoDB(); | |
exports.handler = function(event, context) { | |
console.log("Request received:\n", JSON.stringify(event)); | |
console.log("Context received:\n", JSON.stringify(context)); | |
var tableName = "CommonDynamoDBTable"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create an IAM Lambda role with access to dynamodb | |
// Launch Lambda in the same region as your dynamodb region | |
// (here: us-east-1) | |
// dynamodb table with hash key = dsn | |
console.log('Loading function'); | |
const AWS = require('aws-sdk'); | |
const dynamodb = new AWS.DynamoDB(); | |
exports.handler = function(event, context) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create an IAM Lambda role with access to dynamodb | |
// Launch Lambda in the same region as your dynamodb region | |
// (here: us-east-1) | |
// dynamodb table with hash key = dsn, uniqueid (hashkey for GSI), data (String/Blob) | |
console.log('Loading function'); | |
const AWS = require('aws-sdk'); | |
const dynamodb = new AWS.DynamoDB(); | |
exports.handler = function(event, context) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This is a sample Lambda function that records nanny check in/out activities | |
* in DynamoDB and sends SMS messages to the phone number on file. | |
* | |
* This function creates a DynamoDB table 'button_nanny_checkin' the first time | |
* it runs. The table uses button's DSN as hash key and timestamp as range key. | |
* Each entry has an activity message. | |
* | |
* If phone number is set, an SMS message about this check in/out activity will | |
* be sent. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var https = require('https'); | |
/** | |
* Pass the data to send as `event.data`, and the request options as | |
* `event.options`. For more information see the HTTPS module documentation | |
* at https://nodejs.org/api/https.html. | |
* | |
* Will succeed with the response body. | |
*/ | |
exports.handler = function(event, context) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.handler = function(event, context) { | |
var serialNumber = event.SerialNumber; | |
var clickType = event.ClickType; | |
console.log('Device with serial number', serialNumber, "was", clickType.toLowerCase(), "pressed."); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var aws = require('aws-sdk'); | |
var sns = new aws.SNS(); | |
exports.handler = function(event, context) { | |
payload1 = new Buffer(event.payload); | |
console.log(payload1); | |
var payload2 = payload1 + ' -- processed by Lambda'; | |
console.log(payload2); | |
var params = { | |
Message: payload2, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('Loading event'); | |
// Twilio Credentials | |
var accountSid = '<your twilio Sid>'; | |
var authToken = '<your twilio authtoken>'; | |
var fromNumber = '<your from number>'; | |
var toNumber = '<your to number>' | |
var https = require('https'); | |
var queryString = require('querystring'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('Loading event'); | |
var AWS = require('aws-sdk'); | |
exports.handler = function(event, context) { | |
console.log("Request received:\n", JSON.stringify(event)); | |
console.log("Context received:\n", JSON.stringify(context)); | |
var lambdaFunctionArn = "arn:aws:lambda:us-west-2:555818481905:function:ProcessDeviceData-iot-test-hack-event-1"; | |
var lambdaRegion = "us-west-2"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var aws = require('aws-sdk'); | |
var iot = = new AWS.Iot(); | |
var iotData = = new AWS.IotData(); | |
exports.handler = function(event, context) { | |
// Exercising an IoT Data operation as an example | |
var params = { | |
"topic" : "foo/bar", | |
"payload" : "hello world" |
NewerOlder