Summon Uber with the new AWS IoT Button

A couple of months ago, I wrote a post on how to hack the Amazon dash button to order Uber rides. At that time, I was using the first and only version of the button, whose only purpose was to order products from Amazon. In order to run the hack I had to have a computer running to listen to the button waking up on the network. It did the job, but it was a very hacky solution and I wasn’t really happy with it.

I was looking forward to seeing an update from Amazon where they would open their button to developers.

That day has finally come! Thanks to Nicolas Grenié, who was with 3scale at the AWS re:Invent 2015 last week, I was able to get my hands on the new version of the AWS IoT Button!

Requesting UberX with the new AWS IoT Button (obviously pickup & dropoff locations are made up)

The new AWS IoT Button

This new version is using the new AWS IoT beta which lets you create rules that will trigger different actions, including running AWS Lambda scripts, whenever the button is pressed.

This new button simply connects to your network and send a payload to AWS IoT whenever it is pressed. You can also set a different color pattern for the buttons LED feedback on success/failure. Now this is cool by itself, but the payload content is even cooler. That payload is a simple hash containing 3 attributes:

  • serialNumber: the button’s SN — nothing crazy here
  • batteryVoltage: the button’s battery voltage
  • clickType: the awesome part, it indicate if it is a SINGLE, DOUBLE or LONG press

As you can see, this new version is pretty awesome. It means that I would not need a computer running and inspecting the network anymore!

I took this opportunity to update and simplify my previous uber-dash hack. I came up with a more elegant solution that I am going to share here for the owners of these developers preview buttons — and the future owners.

The platform is still in beta and it wasn’t as straight forward as I thought to get setup and running. Eventually the platform will get better for public launch, but here is how you can do it today:

Setup the button on AWS IoT and connect it to WiFi

By following Amazon’s getting started guide, you can setup the button on the IoT platform in a few minutes. You will need your button’s DSN code — located on the back, and a secret activation code, that was given to you along with the button.

After this setup you should have 4 objects in your AWS IoT dashboard:

  • iotbuttonGXXXX — the button itself which is a Thing
  • XXXX — a Certificate for your button
  • iot-button-policy — a Policy for your button
  • aws_iot_button_rule — a default Rule that you created during the setup process

Your dashboard should look similar to the one below (minus the call_uber rule):

Generate a script that will run when you press the button

Now that you are setup on AWS you will need to come up with a script that will call Uber when the button is pressed.

I created an application that will let you generate your personalized script in 4 easy steps. This script is fairly simple, it just makes a call to Uber’s API in order to place rides requests whenever it is invoked.

Simply go to

  • Login using Uber
  • Select a pickup and a dropoff location on the map.
  • Choose a product in the list of products available in the pickup area
  • Copy and save the script for later

Do not share that script as it contains your personal Uber access token, which would allow anyone to order rides on your behalf!

The source code is available on GitHub. Feel free to open issues (or view the existing ones) and pull-requests:

If you are a developer and don’t want to use this generator — or/and if you know your pickup/dropoff lat/lng as well as your Uber access token, you can just copy and edit the following script:

Create a new rule using AWS Lambda

Once you have generated your script, you can now go back on AWS IoT and create a new rule by selecting your button in the list of Things.

To create a new rule, simply click on the button name on the dashboard and a side panel will open on the right. At the bottom of that side panel you will find a button Create a rule. Select a Name and a Description and use:

  • * : for Attribute
  • iotbutton/+ : for Topic Filter

For the Action, you will need to select Insert this message into a code function and execute it (Lambda).

Then click on the link Create new a resource — skipping the blueprint. Select a name for your Lambda and a description and simply copy paste the personalized script you saved above. Save it and you have now a Lambda that you can use on your rule that is now attached to your button.

Press the button and watch for the Uber App on your phone. You should be able to see your ride being requested automagically. Be careful though, I forgot to cancel once while testing and had to pay a cancellation fee — apologies to the driver who was waiting outside :/

This is really just an example of what the new AWS IoT Button can do. I can’t wait to see what other developers will build with it. With the new AWS IoT platform, the possibilities are endless.

Happy hacking!

Feel free to drop a comment / tweet if I missed anything in this tutorial or if any information is wrong or misleading. Thanks!

If you are looking for an impactful job and want to work with a cool team, Checkr is hiring!