Create an emergency button in under 10 minutes

This post will provide a Step-By-Step guide to create an emergency button to notify SMS and email subscribers.

1 Before you start

You need to have following parts to start:

  1. AWS IoT Button (https://www.amazon.com/All-New-AWS-IoT-Button-Generation/dp/B01KW6YCIM/ref=sr_1_1?ie=UTF8&qid=1515345656&sr=8-1&keywords=iot+button)
  2. AWS Free Tier subscription (https://aws.amazon.com/free/)
  3. Email Address
  4. Smartphone to receive SMS

2 Getting started

  1. Sign in to AWS IoT Console — https://docs.aws.amazon.com/iot/latest/developerguide/iot-console-signin.html
  2. Register you button in the Thing Registry — https://docs.aws.amazon.com/iot/latest/developerguide/register-device.html
  3. Create a device certificate — https://docs.aws.amazon.com/iot/latest/developerguide/create-device-certificate.html
  4. Configure your button — https://docs.aws.amazon.com/iot/latest/developerguide/configure-iot.html
  5. Test your button — https://docs.aws.amazon.com/iot/latest/developerguide/view-mqtt-messages.html

3 Scenario

In this scenario we are using the IoT Button to send emergency messages using the AWS IoT Stack, a Lambda function written in Python and SNS to inform the subscribers via SMS and email.

Scenario

4 Setup

  1. Open the AWS IoT Console
  2. Create new rule
Create rule (1)
Create rule (2)

3. add action

add Lambda function

4. create Lambda function using the python code below. Change TopicArn to your sns topic. https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/US_SetupSNS.html will help you to configure SNS. Configure two subscribers: (1) for SMS and (2) for Email.

create Lambda function
Python code

5. Result

Now you can test your button.

Single click shall notify your configured SNS subscribers with the message “Need help”.

Need help mail

Double click shall notify your configured SNS subscriber with “Need help, it’s urgent.”

Urgent need help mail

Long click shall notify your configured SNS subscriber with “Need help, it’s urgent.”

Hurry up help mail