Sending funny dog GIFs using AWS IoT Button and Lambda

Mar 3, 2019 · 4 min read

I bought an AWS IOT button the other day out of curiosity. I’m not sure on a more permanent solution for it just yet but I’d figured it would do something simple to start.

Goal: Make this button send me funny dog gifs using Lambda. Plus, the infosec community loves dog gifs right??

Fair warning, there is a bit of a set up needed prior to creating the lambda function and connecting the button.

Things you’ll need:

  • Twilio Account SID, Auth Token, and a phone number with MMS capabilities. Check your project settings to get the SID and token. And if you haven’t already, you’ll need to create a project.
  • Giphy API Key from here.
  • AWS IoT Enterprise Button
  • AWS IoT App from app store for iOS or Android
  • Companion Github Files — check out the python source code
  • Your personal phone number to receive the gifs
  • Your Wifi Password


Here are the steps I used to create the lambda function via CLI-ish:

# These steps assume you have the correct IAM permissions to do 
# this locally. If not, please check your IAM policies.

After the packaged was uploaded, I switched to the console to add the following environment variables:

Image for post
Image for post

P.S. Make sure the variables twilio_number and my_number are in the correct format. For me, that meant they followed this format (adding a +1 in front):


Then, I set up and ran the basic test events. If everything is set up properly, you should get a gif texted to your phone.

Now to give this function to an IoT button.

Roll of the sleeves

I logged into the AWS Console and headed over to AWS IOT 1-Click. Under Onboard, then Claim devices, I entered device ID (on the back) of my shiny new button and hit Claim.

Image for post
Image for post

While this screen was waiting, I opened the AWS IoT 1-Click App. If you haven’t already, you’ll need to login with your AWS account.

Side Poll: Anyone else having log in fatigue from all the multi-factor logins?

Image for post
Image for post

Side Note: It felt a little strange having turn ON my GPS location in order to complete the next step. No dropdown? Enter zip? No?? Bluetooth is needed as well.

I clicked Configure Wi-Fi (have your WiFi password ready!), Manually Enter Device ID, then configure. Follow the instructions from here until you are back on the default screen on the app.

If you switch back to the console, you should see this:

Image for post
Image for post

After hitting Done, on the next screen, under Actions, I enabled the button. On the left hand side, I clicked Manage -> Projects.

Here I created a new project and assigned that button to the lambda function created earlier. On Step 1, you’ll name your project and on Step 2, you’ll see the screen below:

Image for post
Image for post

After you have created the project, the second to last step is to create a placement and assign the button to this project.

Image for post
Image for post

The last step is the best part….. Testing!

If everything is correct, you should receive a funny dog gif via text within 15 seconds after hitting the button. Here is the one I got:

Hope this article has been helpful and thank you for taking the time to read it.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store