- Set up an Amazon Web Service (AWS) Account for a Root User
- Configure the AWS IoT Button
- Set up a Developer Account
- Have the Developer Download the AWS IoT Button Dev App
Make a Note of Your Account ID
1. Sign in with your AWS Root Access Account, click on the Arrow next to your Organization Name and select “My Account” from the dropdown.
2. Copy your Account ID from the Account Settings page
The Developer Log-In Process
1. Your developer will have received an email from the AWS Administrator that looks something like the sample below. Make sure you supplied the temporary password; they will click on the link to complete the process of having access to your AWS instance and your button.
2. The link will open up a sign-in page with your organization ID already repopulated. The developer will supply the username and pre-set password and then sign in.
3. The developer will be prompted to change the password. Follow the steps and select “Confirm Password Change.”
4. After changing the password, the developer will land on the AWS Console homepage.
Changing the Action of the AWS IoT Button
1. Log into the Button Dev App as the Developer. You will need the Account ID to do so. Enter the Account ID, User Name, and Password and select “Sign In”
2. Since we’ve already added a button for this account, and assigned the policy for that button to the developer, the button should show up upon login.
3. Click on the image of the button; this will expose three icons. The icon on the left allows you to change the wi-fi network associated with the button.
4. The icon on the right deletes this button from the application.
5. The icon in the middle which controls the Lambda, or serverless app, that runs when you press the button. Click on the Lambda icon.
6. The Lambda detail screen opens on the Existing Lambda functions tab. The email function we added when this button was set up appears.
7. We are now going to change the button actions so it sends an SMS. Click on the New Lambda Functions tab. Choose the Send SMS (nodejs) function.
8. Enter the cell phone number you want to send a text to, and press the set button.
9. When you return to the list of actions, the SMS action should be highlighted. Press “Change Action”.
10. Return to the button image. Notice the action on the button has changed. Wait a minute or two for the action to change up on AWS, then, press the physical button.
11. You should receive a text message.
Customizing the Serverless Function
1. Log back into the AWS console as the developer, and select the Lambda service.
2. There should be two functions. One we added as the root user, and the second, the SMS function we just added as the developer. Click on the SMS function.
3. In the detail screen that pops up, notice how these functions are put together. On the left is the trigger AWS IoT which gets the input from the button. In the center is the meat of the function, usually written in nodejs or python; this accepts input from the AWS IoT trigger on it’s left and runs a little application based on the input. On the right is the output: using Amazon SNS to send the SMS.
4. Scroll down to the middle of the screen to the function’s code, and navigate within that code to the snippet you see below. This is where the message can be customized.
5. Change the message, and press Save.
Testing the Serverless Function Change
1. On the menu bar, click on the triangle next to the empty box (Select a Test Event) to the right of the actions menu. Choose configure test events.
2. Set up here to test the Lambda. Give the test a name. We won’t be using the key value pairs, but these could be used for other functions, like passing the button serial number into the Lambda.
3. Scroll down to the bottom of the create test popup and press “Create.”
4. The test dropdown is now populated, press “Test” to run the Lambda.
5. A success message appears at the top of the screen.
6. The Text Message should now send. Note the “undefined” in the message. This is because the AWS console was used and did not pass the button serial number into the Lambda.
7. Now press the button on the AWS IoT Button. You should get a text message that includes the details of the button that were missing from the test.
Congratulations! You have changed and customized the serverless application that runs on your button. Learn what else you can do with both this button and other smart things by digging into the Revolution11 blogs or YouTube Channel.
Download a PDF version of this: Customizing the AWS IoT Button