Getting started with AWS IoT button

Photo Jun 07, 6 46 53 PM

I ordered the AWS IoT button in May and after a month, it finally arrived. It is just like any Amazon dash button, except the label says “AWS IoT”.

The basic concept of the button is that it can connect to the Internet and do what you program it to do after you press the button, such as send an Email, order a pizza, and turn on the light. It enables the “Internet of Things”. There are many cool things you can do with the button, and you can explore some ideas from the AWS IoT contest.

My idea is to use the button as a doorbell, mostly for delivery notifications: the delivery guy can just press the button, and I will get a real-time SMS or push notification on my iPhone.

Setting up the button is fairly easy, in fact, if you are familiar with AWS Lambda, it will not take more than 30 minutes to program and play.

Step 1: Follow the instructions to register the button with AWS IoT.

Step 2: There are two ways to send push notification to your iPhone: a) If you already have an app in Apple’s App Store, and it is already registered with APNS, then you can re-use this channel for your button; b) As many do not have an app, the easiest way is to use IFTTT Maker Channel to create a new recipe (of course you need to have an IFTTT account as well as the app downloaded):

Trigger: Receive a web request
Event name: AWS_IoT_Button_SINGLE

Action: Send a notification
Notification: Ding Dong!

Note the word “SINGLE”, this is one of the button’s event types. IFTTT will provide you a key, which serves as the auth token for the http request:

And this is the http request that will trigger the event defined in the recipe.

Step 3: Write the Lambda function. I would like the button to do two things: a) Store button click data to DynamoDB; b) Send the http request to IFTTT.

const AWS = require('aws-sdk');
    region: 'us-east-1'
const http = require('https');

const sns = new AWS.SNS();
const doc = new AWS.DynamoDB.DocumentClient();

const IFTTT_KEY = 'your_IFTTT_key';

exports.handler = (event, context, callback) => {

    var now = new Date();
    var ddbRequest = {
        TableName: "iot_button",
        Item: {
            "timestamp": now.toUTCString(),
            "click": event.clickType
    doc.put(ddbRequest, function(e, d) {
        if (e) {
        } else {
            var url = "" + 
                "AWS_IoT_Button_" + event.clickType + 
                "/with/key/" + IFTTT_KEY;
            http.get(url, function(res) {
            }).on("error", function(e) {

Here you go! Make sure the button is associated with this function under “event sources” and it is enabled. Now by pressing the button, you will see a new row in the DynamoDB table and you will receive a push notification!

Photo Jun 10, 9 56 54 PM

Lastly, it is worth noting that the AWS IoT button has its major drawbacks:

  • The battery life only lasts for 1000 clicks – that’s $0.02 per click!
  • It takes about 10 seconds for the button to send the signal, so it may not be a good idea to use it for door bell after all!

On GitHub: