Professional Documents
Culture Documents
9/17/20 3
Cloud Services: On-premise Software
Ø Traditional APP
Data
Ø installed and runs on
personal computer Runtime
You Manage
q Hardware
OS
q OS
q Software Virtualization
Server
Ø Example
q This presentation Storage
Network
9/17/20 4
Infrastructure as a Service (IaaS)
Ø IaaS
APP
q "physical server box” Web
q Virtual Machine Service Data
You Manage
• Memory
Runtime
• Storage
• CPU Middleware
• Network
OS
Ø Example
9/17/20 5
Platform as a Service (PaaS)
You Manage
Ø PaaS APP
q You get a framework
Data
q Host Application
q Tools Runtime
Middleware
9/17/20 6
PaaS Example: AWS IoT
Tools
Framework
The essence is MESSAGING MIDDLEWARE
9/17/20 Send messages between sensors and servers… 7
Software as a Service (SaaS)
Ø SaaS APP
q You get a whole solution
Data
Ø Example Middleware
q Gmail
OS
q Dropbox
q Office365 Virtualization
Server
Storage
Network
9/17/20 8
XaaS: A Recap
On-Premise IaaS PaaS SaaS
You Manage
APP APP APP APP
You Manage
Runtime Runtime Runtime Runtime
OS OS OS OS
Service Provider Manages
Virtualization Virtualization Virtualization Virtualization
q Challenge
• United: Connected + Communication
• Smart: Data Analytics + Strategy
Amazon SNS
Subscribe to a topic
Temperature sensor
Period: 5s (0.2Hz)
Message middleware
9/17/20 Source: https://aws.amazon.com/iot-platform/ 13
Basic Interact: Subscribe/Publish
Ø You can define your own Topic (Twitter Account)
Ø Subscriber can receive the message you published to your
topic
I am going to publish a
tweet.
“Today is beautiful ”
Tw
e” “P ee
ow i b ub t
ll r lis
Fo bsc h”
“su Twitter account
a “Topic”
Received message
Subscriber from Trump:
“Today is beautiful”
Publisher
9/17/20 14
Resources
Ø Amazon IoT
q http://docs.aws.amazon.com/iot/latest/developerguide/what-is-
aws-iot.html
Ø Raspberry Pi
q https://www.raspberrypi.org/
15
Get into AWS Manage Console
Ø Create your own AWS account
Ø Sign In IoT Manage Console
q https://aws.amazon.com/iot/
9/17/20 16
Step 1: Create a Virtual "Thing”
Ø Virtual “Thing”: a virtual copy of your thing
q A Thing in AWS IoT has a “shadow”
• a JSON document that is used to store and retrieve current
state information for a device.
§ E.g. Battery level, Connectivity, data
A “Dashboard” to show some info
q Authentication, Security
q Permission and roles
9/17/20 17
Create a thing
Ø 1. AWS IoT Menu
• Things è Create
Ø 2. Give a name
9/17/20 18
19
20
The keys and cert will be used
later
21
Create Policy
Ø A policy is attached to a key/cert
q It tells what this key/cert can do
22
Here, we grant it all permissions for demo!
23
This is the policy you created
24
Attach Policy
Ø Attach Policy to the key/cert
q A policy tells what this key/cert can do
25
26
27
Now, you have a virtual thing on AWS!
28
AWS Things Summary
q Certificate: authenticate the device
q Policy: define the roles/permissions of the
certificate
q Virtual copy of the thing (Shadow): Store/retrieve
some information
29
Let’s test it online!
Basic Interact: Publish to the “Shadow”
Ø Get your “Shadow” Shadow is a special topic
q In your Thing Page
Shadow Topic
9/17/20 31
Find your “Shadow” Topic
Ø Topic: can be seen as the “address”
Shadow Topic:
$aws/things/cse521/shadow/update
9/17/20 https://docs.aws.amazon.com/iot/latest/developerguide/device-shadow-mqtt.html?icmpid=docs_iot_console 32
Ø Using Embedded Test Client to Test Your Shadow Topic
q In AWS IoT Page
Topic Message
9/17/20 33
Shadow Message
{ "state": {
"reported":{
"welcome": "CSE521s",
"time":"13:45",
"temperature":"25"}
},
"message": "Hello from CSE521s console"}
34
Update Shadow
Ø In your “Thing” Page
35
Basic Interact: Subscribe/Publish
Ø You can define your own Topic
Ø Once you have a subscriber that is subscribed to the topic,
the subscriber can receive the message
9/17/20 36
Step 2: Connect a “Physical” Device
Certificate
AWS SDK Client
Temperature sensor
Period: 5s (0.2Hz)
Copy Policy
9/17/20 37
Connect your Device
Ø Copy certificates to your physical things
q Downloaded before!
9/17/20 38
Some Notes
Ø 1. Copy the certificates/keys to your real thing
Host(Endpoint)
Ø 3. Set up your configuration of the code with SDK
40
More: Rule Engine, Link with SNS services
Ø Simple Notification Service
AWS IoT
Publish
Virtual “Thing”
EC2 t2.micro / Shadow
AWS
Forward
Subscribe
Topic:
CSE521_Tutorial
Ø Add an Action:
q Forward this message to SNS
q Specify Dest ARN
q Enable Rule
9/17/20 42
Notification on SMS & Email
9/17/20 43
One More Thing: Account Security
Ø DON’T UPLOAD YOUR KEY PUBLICLY!!!
9/17/20 44
Source: WeChat Subscriptions: 西乔《神秘的程序员们 39》 Geek Life Chpt 39.
What if… $50,000 AWS Bill!
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
Some project examples
Ø Gesture recognition with smartwatch
q Recognize the specific gesture to control the light
Ø Smart mirror
q Show personalized info in the mirror
Ruixuan Dai