The sample system has the following functionalities:
- Subscribe AWS Kinesis Stream to ARTIK Cloud
- Devices send data to ARTIK Cloud
- Read device data from Kinesis Stream
We build two applications to achieve Item 1 and 3, and use the Device Simulator instead of real devices to achieve Item 2.
After completing this sample, you will learn the following objectives:
- How to subscribe Kinesis Stream to ARTIK Cloud via API calls
- How to read data from Kinesis Stream using AWS SDK for Java
- How to delete a subscription in ARTIK Cloud via API calls
- Java version >= 1.8
- Apache Maven >= 3.3.9
- AWS SDK for Java
- Amazon Kinesis Streams setup
- Open My ARTIK Cloud and connect a device (or use one that you already own) of the device type (for example, Demo Fire Sensor with unique name
cloud.artik.sample.demofiresensor
). You will use the device simulator to send data to ARTIK Cloud on behalf of this device later. - Open the API Console and follow the instruction to get the access token. This access token is your user token. Then get your user ID. Note the user ID and access token. You will need them later.
- Sign up for an AWS account if you have not done so.
- Get the AWS access key and secret of your AWS user/role. You will need them later.
- Create a Kinesis stream with one shard on aws site. For example, you can do it using the AWS Kinesis Console. Noted the stream name (e.g. akcstream) and service region (e.g. us-west-1). You will need them later.
- Clone this repository if you haven't already done so.
- Build the subscription app. Go to
sub-kinesis-stream-to-akc
directory and run the following command:
mvn clean package
The executable sub-kinesis-to-akc-x.x.jar
is generated under the target directory. Run the following command to learn the usage:
java -jar sub-kinesis-to-akc-x.x.jar -h
- Build the Stream reader app. Go to
kinesis-stream-consumer
directory from the root and run the following command:
mvn clean package
The executable read-stream-x.x.jar
is generated under the target directory. Run the following command to learn the usage:
java -jar read-stream-x.x.jar -h
Read the blog post Build a system to send ARTIK Cloud data to an Amazon Kinesis Stream for the full details!
If you are not familiar with ARTIK Cloud, we have extensive documentation at https://developer.artik.cloud/documentation
The full ARTIK Cloud API specification can be found at https://developer.artik.cloud/documentation/api-spec
Check out advanced sample applications at https://developer.artik.cloud/documentation/samples/
To create and manage your services and devices on ARTIK Cloud, create an account at https://developer.artik.cloud
Also see the ARTIK Cloud blog for tutorials, updates, and more: http://artik.io/blog/cloud
Licensed under the Apache License. See LICENSE.
Copyright (c) 2017 Samsung Electronics Co., Ltd.