AWS IoT Button setup — with the new mobile app and IFTTT!

Joseph Guerra
6 min readFeb 2, 2017

Setup used to be intimidating. Now, it’s straightforward, with the new mobile app! Thanks Amazon! And just in time for the newly available 2nd generation buttons, with 2000 click batteries.

Backstory

Rewind a few months. I bought an AWS IoT button. I followed Amazon’s getting started guide. I manually set up things, certificates, policies, and roles. After an hour, I was stuck. I could not “press the button, and get a SMS”. I had a friend help. We solved it together. Phew! Two hours for “hello world”? It dampened my IoT button enthusiasm.

Amazon’s slightly overwhelming AWS IoT Button system architecture

Fast forward to now. I make another attempt at the button. I visit AWS IoT Getting Started. Hmm… this is different. What’s that? A new AWS IoT Button mobile app?! I download the app. 10 minutes later, I press my button and get a text through IFTTT Maker. I pat myself on the back. 10 minutes more, and I’m spamming Slack with the press of a button. Awesome!

The new app, and IFTTT, take a ton of frustration out of the original setup.

Amazon’s new IoT setup app

This post explains how to set up your AWS IoT Button with IFTTT, with the tools I wish existed a few months ago.

Pre Setup — Computer

  1. Buy an AWS IoT Button. 2nd generation buttons are out!
  2. Create an AWS account. You need a credit card. There’s a free tier.
  3. Have your button handy for setup. Keep the box. The serial number barcode is helpful. Plus, it’s hard to read the serial when you stick your button onto something with the adhesive.
IoT button in its box with helpful serial number barcode

IoT Button App — Phone

  1. Download the AWS IoT Button app for Android or iOS
  2. Launch the app
  3. Set up AWS IoT button
  4. Follow the directions. The app nicely guides you.
  5. Scan your button barcode. Did you keep the box? If not, enter it.
  6. 6-second-press your button to connect and configure wifi
  7. Choose what happens when your button is pressed
  8. Select Trigger IFTTT Maker (nodejs) for your button action. The other options are nice, but IFTTT opens a ton of possibilities, with so many other connected services, beyond email or SMS.
  9. The app prompts you for a Maker API key… that’s coming up next.
  10. Set the phone aside. Switch to IFTTT on your computer.
AWS IoT Button app during button setup

IFTTT Applet — Computer

  1. Sign in to IFTTT, or create an account
  2. Create a new applet. (IFTTT used to call these recipes.)
  3. Select Maker. This service makes and receives web requests. Neat!
  4. Select Receive a web request
  5. Enter an Event Name. You’ll use this later. Something like buttonPress.
  6. Choose the SMS action. This action happens when Maker recognizes you pressed your button. Later, I mention how to change to another action.
  7. Writer yourself a clever SMS message
  8. Save
  9. Well played! You created your applet (recipe).
  10. Now get the Maker API key. This is tricky to find on IFTTT. It’s in the Maker settings. The key is that big string of junk in the URL.
IFTTT setup with Maker and SMS to get Maker API key

IoT Button App —Back to your phone

  1. Get the Maker API key on your phone. I email it to myself for easy copy-and-paste. Or manually type it in … good luck.
  2. Tap OK
  3. Set Action
  4. The app does its magic: setups up Lambda, certificates, policies, etc.
  5. The button is now setup in AWS with all it’s parts. Lambda knows to reference IFTTT. Great! A few more steps to connect the final pieces.
Finish setup in app with your IFTTT Maker API key

AWS Console — Computer

  1. Sign into to the AWS console
  2. Navigate to Lambda. You’re about to tell Lambda about the event you made in IFTTT. Remember buttonPress?
  3. Click the Lambda function to edit it. The phone setup created this. You just need to make a quick edit. Easy!
  4. Look on line 29 and 30. Make sure buttonPress is the makerEvent. This bit of code now says: when you press the button, Lambda requests the buttonPress event. That event initiates your IFTTT Maker applet, which sends a SMS.
  5. Save. If you Save and test, you should get a SMS since Lambda fires off the IFTTT SMS event.
AWS Lambda configuration for IoT Button event

IoT Button

  1. Take hold of your button
  2. Deep breath…
  3. Push the button! (single press)
  4. Moment of truth…
  5. Did you get a SMS message?
  6. Great success!
  7. If you’re like me, you’ll cheer if it worked. (Or you’ll scowl, if it didn’t. Double check your Maker API key, event name, AWS regions, Lambda code on lines 29 and 30.)
The sheer joy of pressing your AWS IoT button

Get creative

Now, your button is setup in AWS. And connected to IFTTT. You have the full range of IFTTT actions to choose from. Email, phone, social, todo lists, home appliances, etc. Create a new applet with the same Maker settings and choose another action.

There are many IFTTT actions. What will you make your button do?

I created an IFTTT applet to post in Slack, to show off my renewed IoT button skills.

When I pressed my AWS IoT button, I posted a message in Slack

Get inspired

Need ideas? What repetitive tasks do you have? Could they be a single button press?

Tell coworkers when the coffee is fresh. Have it order pizza. Or totally nerd out with a button and algorithm that texts where to eat, based on weather, and bank balance.

Add a line to a spreadsheet every time you eat a healthy meal. Give a button to your kid, or elderly parent, to press when they need something. Keep a button to work, to trigger your house lights, alarm, surveillance camera, thermostat, ice maker, or cat food dispenser.

If you’re really clever, you can use the SINGLE, DOUBLE, or LONG press options too. That gives 3 potential button functions. You could have it SMS, email, and add a card to Trello. All from one button. Radical!

Advanced Stuff

Check out the IFTTT Maker internal api. You can test events and pass JSON options. Fancy!

Test events and options with Maker

See your button in AWS IoT Console

Go back to the IoT AWS Console (also in version 2, thanks again Amazon). You can see a bunch of gory details about your button (things), certificates, policies, settings, etc.

AWS IoT Console version 2. Do advanced stuff here.

Cleanup

If you want to start over, here are the items to remove. Cleanup used to be hard, but the AWS IoT Button mobile app makes that easier too. You remove the IoT device, certificates, policies, etc., in a single step. But you still have to clean up a few other things in AWS like IAM and Lambda.

Tap your button in the app to remove it, and all the AWS IoT stuff, in a single step
  1. In the mobile app, delete your device
  2. In Lambda, delete the IoT device function
  3. In IAM, delete your IoT button role
  4. In IFTTT, remove your Maker IFTTT applet

Final thoughts

I hope this post inspires you to try an AWS IoT Button. Don’t be intimidated! Setup is straightforward with the mobile app and IFTTT Maker.

I’d like to read your interesting button uses and IFTTTs, in the comments!

--

--

Joseph Guerra

Digital Product Manager. Interested in blockchain, motorbikes, and painting.