AWS IoT Button Wizard Quickstart
The AWS IoT button wizard is a Lambda blueprint, so you need to sign in to the AWS Lambda console in order to use it. If you do not have an AWS account, you can create one by following these steps.
To create an AWS account
Open the AWS home page and choose Create an AWS Account.
Follow the online instructions. Part of the sign-up procedure involves receiving a phone call and entering a PIN using your phone's keypad.
To configure the AWS IoT Button
Sign in to the AWS Management Console and open the AWS Lambda console.
If this is your first time in the AWS Lambda console, you will see the following page. Choose the Get Started Now button.
If you have used the AWS Lambda console before, you will see the following page. Choose the Create a Lambda function button.
On the Select blueprint page, from the Runtime drop-down menu, choose Node.js 4.3. In the filter text box, type
button. To choose the iot-button-email blueprint, double-click it or choose the Next button.
On the Configure triggers page, from the IoT Type drop-down menu, choose IoT Button.
Type the serial number for your device. You'll find the device serial number (DSN) on the back of the button.
Choose Generate certificate and keys.
You only need to generate a certificate and private key once. Then you can navigate to http://192.168.0.1/index.html in a browser to configure your button.
Use the links on the page to download the device certificate and the private key.
The page also includes instructions for configuring your AWS IoT button. On step 3, you will choose a link to open a web page that allows you to connect the AWS IoT button to your network. Under Wi-Fi Configuration, type the network ID (SSID) and network password for your Wi-Fi network. Under AWS IoT Configuration, choose the certificate and private key you downloaded earlier. This will copy your certificate and private key to your AWS IoT button. Select the check box to agree to the AWS IoT button terms and conditions, and then choose the Configure button.
A configuration confirmation page will be displayed.
Close the Configure tab and go back to the AWS Lambda console page. Choose Enable trigger, and then choose Next.
On the Configure function page, type a name for your function. The description, runtime, and Lambda function code will be entered for you.
In the Lambda function code, replace the example email address with your own email address.
In the Lambda function handler and role section, from the Role drop-down menu, choose Create new role from template(s). Type a unique name for the role.
At the bottom of the page, choose Next.
Review the settings for the Lambda function, and then choose Create function.
You should see a page that confirms your Lambda function has been created:
To test your Lambda function, choose the Test button. After about a minute, you should receive an email message with
AWS Notification - Subscription Confirmationin the subject line. Choose the link in the email message to confirm the subscription to an SNS topic created by the Lambda function. When AWS IoT receives a message from your button, it will send a message to Amazon SNS. The Lambda function created a subscription to the Amazon SNS topic using the email address you added in the code. When Amazon SNS receives a message on this Amazon SNS topic, it will forward the message to your subscribed email address.
Press your button to send a message to AWS IoT. The message will cause your Lambda rule to be triggered, and then your Lambda function will be invoked. The Lambda function will check to see if your SNS topic exists. The Lambda function will then send the contents of the message to the Amazon SNS topic. Amazon SNS will then forward the message to the email address you specified in the Lambda function code.