{"id":13414335,"url":"https://github.com/mongoose-os-apps/aws-iot-button","last_synced_at":"2025-10-26T23:14:05.735Z","repository":{"id":103983656,"uuid":"97099258","full_name":"mongoose-os-apps/aws-iot-button","owner":"mongoose-os-apps","description":null,"archived":false,"fork":false,"pushed_at":"2020-08-20T19:02:42.000Z","size":30,"stargazers_count":38,"open_issues_count":3,"forks_count":17,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-23T21:44:25.548Z","etag":null,"topics":["aws","button","iot","lambda","sns"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mongoose-os-apps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-07-13T08:31:53.000Z","updated_at":"2023-02-05T14:17:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"422b141c-9ff3-4b42-83b5-d700b17f461d","html_url":"https://github.com/mongoose-os-apps/aws-iot-button","commit_stats":null,"previous_names":[],"tags_count":53,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongoose-os-apps%2Faws-iot-button","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongoose-os-apps%2Faws-iot-button/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongoose-os-apps%2Faws-iot-button/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongoose-os-apps%2Faws-iot-button/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mongoose-os-apps","download_url":"https://codeload.github.com/mongoose-os-apps/aws-iot-button/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250522290,"owners_count":21444509,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","button","iot","lambda","sns"],"created_at":"2024-07-30T21:00:19.374Z","updated_at":"2025-10-26T23:14:00.699Z","avatar_url":"https://github.com/mongoose-os-apps.png","language":"JavaScript","funding_links":[],"categories":["Awesome Mongoose OS [![Awesome](https://awesome.re/badge.svg)](https://awesome.re)"],"sub_categories":["Official Examples"],"readme":"# AWS IoT button example\n\nThis is an Internet Button reference project: when a button on the device\nis pressed, a cloud backend gets a notification and performs an action.\nIn this particular case, AWS Lambda function sends an email to the specific\nemail address. But, again, the action could be anything.\n\n[![aws iot button](https://img.youtube.com/vi/yZ8VAxJ2XpA/0.jpg)](https://www.youtube.com/watch?v=yZ8VAxJ2XpA)\n\n## Prerequisites\n\n- Hardware: ESP8266 NodeMCU\n- Amazon AWS account\n- Amazon's `aws` management tool (see https://aws.amazon.com/cli)\n- `mos` management tool installed\n  (see [mos installation guide](https://mongoose-os.com/software.html))\n\n## Architecture\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"aws_button.png\" width=\"75%\"\u003e\n\u003c/p\u003e\n\nThe data flow is as follows:\n\n- User presses the button\n- Device sends a message to the MQTT topic `DEVICE_ID/button_pressed`\n- AWS IoT receives the message and calls AWS Lambda Function\n- AWS Lambda Function publishes a message to the AWS SNS (Simple Notification Service)\n- AWS SNS notifies subscribers: in this case, just sends a message to a single email address\n- User receives the email\n\n## Build instructions\n\n1. Follow the [Cloud side setup](https://mongoose-os.com/aws-iot-starter-kit/#cloud) instructions to setup AWS CLI utility and your AWS credentials\n2. Follow the [Device setup](https://mongoose-os.com/aws-iot-starter-kit/#dev) instructions to setup your device and provision it to the AWS IoT\n3. Download [this repository as a zip file](https://github.com/mongoose-os-apps/aws-iot-button/archive/master.zip) and extract this app on your computer\n4. Exit any running `mos.exe` process\n5. Open a command prompt (on Windows) or terminal (on Mac/Linux) and go to the extracted app.\n6. You should be able to see the `mos.yml` file by running `dir mos.yml` command (on Windows) or `ls -l mos.yml` (on Mac/Linux)\n7. Find out your device ID\n```\nmos config-get device.id\n``` \nOn Windows, here and further, you might need to\nspecify the full path to the `mos.exe` binary:\n\n```\nc:\\path\\to\\mos.exe config-get device.id\n```\n8. Run the following command to create AWS Cloud Formation stack.\n   Change `$DEVICE_ID` to your actual device ID, and `$MY_EMAIL` to your email:\n\n```\naws cloudformation create-stack --stack-name my-internet-button --parameters ParameterKey=TopicName,ParameterValue=$DEVICE_ID/button_pressed ParameterKey=SubscriptionEmail,ParameterValue=$MY_EMAIL --capabilities CAPABILITY_IAM --template-body file://aws_button_template.json\n```\n\n9. Wait until the stack creation is completed (it may take a few minutes).\n   Alternatively, you can use the web UI to check the status and read event\n   details: https://console.aws.amazon.com/cloudformation/home\n\n10. During the stack creation, AWS will send a Subscription Confirmation email,\n   so check your email and confirm the subscription by following a link.\n\n11. Run the following command to ensure that the stack creation is complete:\n```\naws cloudformation wait stack-create-complete --stack-name my-internet-button\n```\n\n11. Copy the `fs/init.js` file to your device:\n```\nmos put fs/init.js\n```\n\n12. Attach to the device to see the device logs \n```\nmos console\n```\n13. Reboot your device by pressing a reboot button\n13. When the device is connected to the AWS IoT, push the \"flash\"\n    button on your device.\n    In the device's console, you'll see a message like this:\n\n```\nPublished: yes topic: esp8266_DA84C1/button_pressed message: {\"free_ram\":26824,\"total_ram\":44520}\n```\n\nNow, check your email. It'll contain a new message:\n\n```\nButton pressed: esp8266_DA84C1/button_pressed\n```\n\n14. Now you can go to your AWS dashboard and play with your stack.\n  For example, you may add more subscriptions to the SNS: other than\n  sending emails, it can also call some URL, send SMS, etc. And, of course,\n  you can modify your lambda function to do whatever you want in response to\n  the button press.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmongoose-os-apps%2Faws-iot-button","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmongoose-os-apps%2Faws-iot-button","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmongoose-os-apps%2Faws-iot-button/lists"}