This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 sends an Email or SMS on click of a button. It creates a SNS topic, subscribes an endpoint (SMS/EMAIL) | |
//to the topic and publishes to the topic. | |
/* | |
The following JSON template shows what is sent as the payload. | |
{ | |
"serialNumber": "GXXXXXXXXXXXXXXXXX", | |
"batteryVoltage": "mV", | |
"clickType": "SINGLE | DOUBLE | LONG" | |
} |
This file contains hidden or 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 iotdata = new AWS.IotData({endpoint: '<CUSTOM ENDPOINT HERE>.iot.<REGION>.amazonaws.com'}); | |
exports.handler = function(event, context) { | |
var params = { | |
thingName: '<THING NAME', | |
payload: '{"state":{"desired":{<STATE GOES HERE>}}}' |
This file contains hidden or 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
{ | |
"sql": "SELECT (CASE Clicks WHEN '1' THEN 'Yo' WHEN '2' THEN 'Wassup?' ELSE 'Howdy.' END) AS message FROM 'button/press'", | |
"ruleDisabled": false, | |
"actions": [{ | |
"sns": { | |
"roleArn": "arn:aws:iam::115330095819:role/icebreaker-sns-actions-role", | |
"targetArn": "arn:aws:sns:us-east-1:115330095819:text-a-phone" | |
} | |
}] | |
} |
This file contains hidden or 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" |
This file contains hidden or 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 hidden or 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"; |
NewerOlder