Cloud Tutorial: AWS IoT
CSE 521S Fall
- Sep. 17, 2020
Cloud Tutorial: AWS IoT CSE 521S Fall Sep. 17, 2020 Ruixuan - - PowerPoint PPT Presentation
Cloud Tutorial: AWS IoT CSE 521S Fall Sep. 17, 2020 Ruixuan (Corey) Dai XaaS: Basics in Cloud Computing Cloud Computing Cloud computing provides shared pool of configurable computing resource to end users on demand Three service models q
9/17/20 3
q IaaS (Infrastructure as a Service): virtual machines, storage,
q PaaS (Platform as a Service): execution runtime, middleware,
q SaaS (Software as a Service): email, virtual desktop, games …
Ø installed and runs on personal computer Ø You Manage and Deploy
q Hardware q OS q Software
Ø Example
q This presentation
9/17/20 4
APP Data Runtime Middleware OS Virtualization Server Storage Network You Manage
q "physical server box” q Virtual Machine
q AWS EC2 q AWS EFS
q Build up you VM cluster
9/17/20 5
You Manage APP Data Runtime Middleware OS Virtualization Server Storage Network Service Provider Manages
Web Service
q You get a framework q Host Application q T
q AWS IoT
q Build up you’re smart A/C
9/17/20 6
You Manage Service Provider Manages APP Data Runtime Middleware OS Virtualization Server Storage Network
9/17/20 7
The essence is MESSAGING MIDDLEWARE Send messages between sensors and servers…
q You get a whole solution
q Gmail q Dropbox q Office365
9/17/20 8
Service Provider Manages APP Data Runtime Middleware OS Virtualization Server Storage Network
9/17/20 9
APP Data Runtime Middleware OS Virtualization Server Storage Network You Manage You Manage APP Data Runtime Middleware OS Virtualization Server Storage Network Service Provider Manages You Manage Service Provider Manages APP Data Runtime Middleware OS Virtualization Server Storage Network Service Provider Manages APP Data Runtime Middleware OS Virtualization Server Storage Network
9/17/20 11
q Devices
§ Sensors, actuators
q Data and Command
q Challenge
Source: https://aws.amazon.com/iot-platform/ http://www.brain-smart.net/smart-brain-health-blog/page/2/#axzz4W4oSp8a6
9/17/20 12
United: Connect + Communication Smart: Other Cloud Service Data Storage Machine Learning
Source: https://aws.amazon.com/iot-platform/
Stated: “Thing Shadow”
9/17/20 13 Source: https://aws.amazon.com/iot-platform/
Publish to a topic Amazon SNS Forward Subscribe to a topic Temperature sensor Period: 5s (0.2Hz) Message middleware
q Publisher (e.g. Sensor), Subscriber (e.g. Server), Topic
9/17/20 14
Follow “subscribe” a “Topic” I am going to publish a tweet. “Today is beautiful ” Twitter account Tweet “Publish” Received message from Trump: “Today is beautiful” Subscriber Publisher
q http://docs.aws.amazon.com/iot/latest/developerguide/what-is-
q https://www.raspberrypi.org/
q http://cps.cse.wustl.edu/index.php/List_of_Projects
q https://aws.amazon.com/education/awseducate/apply/
15
q https://aws.amazon.com/iot/
9/17/20 16
9/17/20 17
AWS IoT Virtual “Thing” / Shadow
q A Thing in AWS IoT has a “shadow”
state information for a device.
§ E.g. Battery level, Connectivity, data
q Shadow is a special topic in AWS IoT
q Authentication, Security q Permission and roles A “Dashboard” to show some info Certificates -> your ID Policy -> your permission book
9/17/20 18
19
20
21
The keys and cert will be used later
q It tells what this key/cert can do
22
23
Here, we grant it all permissions for demo!
24
This is the policy you created
q A policy tells what this key/cert can do
25
Click the cert you just created
26
27
28
29
q Certificate: authenticate the device q Policy: define the roles/permissions of the
q Virtual copy of the thing (Shadow): Store/retrieve
q In your Thing Page
9/17/20 31
Shadow Topic Shadow is a special topic
9/17/20 32 https://docs.aws.amazon.com/iot/latest/developerguide/device-shadow-mqtt.html?icmpid=docs_iot_console
Shadow Topic: $aws/things/cse521/shadow/update
q In AWS IoT Page
9/17/20 33
Your Shadow Topic Topic Message
34
A Shadow Message is a JSON object. Shadow message has strict formats. Please see https://docs.aws.amazon.com/iot/latest/developerguide/device- shadow-document-syntax.html
35
9/17/20 36
Temperature sensor Period: 5s (0.2Hz)
9/17/20 37
AWS IoT Virtual “Thing” / Shadow Attach Certificate Policy Copy AWS SDK Client AWS IoT SDK
q Downloaded before!
q Node JS q Python (pip install AWSIoTPythonSDK) q Java q …
9/17/20 38
9/17/20 39
Host(Endpoint) Change your code accordingly!
40
9/17/20 41
Publish Amazon SNS AWS IoT Virtual “Thing” / Shadow Forward Topic: CSE521_Tutorial Subscribe Subscribe
EC2 t2.micro
q Forward this message to SNS q Specify Dest ARN q Enable Rule
9/17/20 42
9/17/20 43
9/17/20 44
Time to Open Source!
Source: WeChat Subscriptions: 西乔《神秘的程序员们 39》 Geek Life Chpt 39.
9/17/20 45 Source: https://www.quora.com/My-AWS-account-was-hacked-and-I-have-a-50-000-bill-how-can-I-reduce-the-amount-I-need-to-pay
q Recognize the specific gesture to control the light
q Food dispenser with schedules and smart control
q Show personalized info in the mirror
46