Kinesis Data Streams vs SQS and say hello to IoT
SQS use case:
- Order processing
- Image processing
- Auto scaling que
- Buffer and batch message for future processing
- Request Offloading
Kinesis use case:
- Fast log and event data collection and processing
- Real time metrics and report
- Mobile data capture
- Gaming data feed
- Complex Stream processing
- IoT
Hello from IoT
IoT stands for Internet of Things so IoT thing can be what ever you want like here it’s thermostat,bike bla bla.
So how is it work?
IoT > Thing Registry
Thing registry giving device an ID making sure it’s well authenticated,security.
After that IoT thing need to communicate with our cloud and through this it uses something called a device gateway.
This device gateway is managed service which allows you to communicate with your IoT.
For example when your IoT device was to report some things for example temperature it’s going to send a message to an IoT message broker it’s like SNS topic and Rules engine send our message to different targets like Kinesis, SQS, Lamba. You can also integrate with something called an IoT device shadow.
What is Device Shadow?
If your IoT device not connected to the internet you can change it’s state here on the device shadow for example we store temp. with out IoT devices and some device gone don’t worry we have device shadow. Device Shadow it’s like imagine device twin on cloud. When reconnected our device, shadow device say “dude I have news for you come on take this temp value” and that’s all.
IoT Device Gateway
- Serves as the entry point for IoT devices connectiong on AWS
- Allows devices to securely and effective communicate with AWS IoT
- Support HTTP, MQTT, WebSocket
- No need to manage any infrastructer
Example: IoT > MQTT > Device Gateway
IoT message Broker
- Publisher/subscribers messaging pattern -low latency
- Message are published into topics (like SNS)
- Message broker forwards messages to all clients connected to the topic
Example: IoT > MQTT > Device Gateway > Message Broker
IoT Registery = IAM of IoT
- Organizes the resources associated with each device in the AWS
- Each device get unique ID
- Can create x.509 cert. to help IoT devices can connect to AWS
- IoT group devices together and apply permission to the group
How is authentication is work ?
Our device is basically registered with the aws thing registry you have 3 methods in here.
- Create x.509 cert and load them securely into the Things
- AWS SigV4
- Custom token
For mobile apps:
- Cognito
For web:
- IAM
- Federated Identites
AWS IoT polices:
- Attached to X.509 or cognito
- Able to revoke any device at any time
- Json doc.
- Can be attached to groups instead of individual Things.
Device Shadow
- Json doc.
- We can set the state on different desired state (open light ,close light, open the blue light etc.)
Rules Engine
- Rules are defined on the MQTT topics
- Rules = when it’s trigger | Action = what is does
Use case:
- Augment or filter data from device
- Write data to dynomoDB
- Save file to S3
- Send push notification with SNS
- Publish data to SQS que
- Process message from a large number of devices using Amazon Kinesis
- Capture with CloudWatch
- Send data to Sagemaker learn something
IoT Rules need IAM roles to perform their action.
IoT Topic > IoT Rules > IoT Rules Action (Kinesis, DynomoDB, S3, SNS, SQS)
IoT Greengrass
Brings the compute layer on the device directly and you can execute on lambda for example pre-processing the data, keep device data in sync, execute prediction on SageMaker.