Filter results by

Push to Amazon Kinesis

ARTIK cloud services subscription and notification are securely integrated with Amazon Kinesis, the real-time data ingestion framework of Amazon Web Services (AWS). You can push messages or Actions from an ARTIK cloud services user or device to an AWS account in real-time. Together with AWS tools such as Amazon Machine Learning and Amazon EMR, this allows you to enhance applications with custom analytics or machine learning.

Subscribe Kinesis to ARTIK Cloud

When subscribing Amazon Kinesis to ARTIK cloud services, only Steps 1 and 7 in the subscription sequence are relevant.

At Step 1 of the subscription sequence, the client makes an HTTP POST call to create a subscription.

POST /subscriptions

Refer to the table of subscription fields to determine which parameters you should include in your request body.

To subscribe an Amazon Kinesis Stream to ARTIK cloud services, subscriptionType must be set to awsKinesis in the subscription object. Instead of a callback URL, you specify your Kinesis credentials (awsKey, awsSecret, awsRegion and awsKinesisStreamName).

1
2
3
4
5
6
7
8
9
10
{
  "messageType": "message",
  "uid": "5beb4e30",
  "subscriptionType": "awsKinesis",
  "awsKey": "ABC",
  "awsSecret": "XYZ",
  "awsRegion": "us-west-1",
  "awsKinesisStreamName": "stream1",
  "description": "This is a subscription to user’s devices"
}

Subscription fields (Amazon Kinesis only)

Field Description Notes
awsKey Key of the AWS user/role with (write) access to the Amazon Kinesis stream. Required for subscription creation.
awsSecret Secret of the AWS user/role with (write) access to the Amazon Kinesis stream. Required for subscription creation.
awsRegion Region of the AWS user/role with (write) access to the Amazon Kinesis stream. Required for subscription creation.
awsKinesisStreamName Stream name of the Amazon Kinesis stream. Required for subscription creation.

At Step 7 of the subscription sequence, ARTIK cloud services send the HTTP response with the subscription JSON object to the client. This completes the subscription process.

Below is an example of a Kinesis subscription object:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
  "data":{
    "id":"1673d7394737480d847023acfcc50c9d",
    "aid":"f9c81f2eb69343efb336ba2b97b7b7e2",
    "messageType":"message",
    "uid":"5beb4e30",
    "description":"This is a subscription to a user's devices",
    "subscriptionType":"awsKinesis",
    "awsKey":"ABC",
    "awsSecret":"XYZ",
    "awsRegion":"us-west-1",
    "awsKinesisStreamName":"stream1",
    "status":"ACTIVE",
    "createdOn":1435191843948,
    "modifiedOn":1439489593485
  }
}

ARTIK cloud services, as an Amazon Kinesis producer, will write filtered messages or Actions directly into the Amazon Kinesis Stream.

Post messages to Kinesis

Messages and Actions written to the Amazon Kinesis Stream have the format used in the REST API.

Error handling

If ARTIK cloud services fail to send messages to the Kinesis stream because Kinesis responded with a Bad Request error, the subscription will be deleted and the error will be logged in the Developer Dashboard. Bad Request errors can be caused by:

  • Incorrect credentials
  • Credentials with insufficient rights
  • Nonexistent Kinesis Stream name

Examples

Once the data is sent to Kinesis Streams by ARTIK cloud services, you can consume the data for analytics or machine learning. Please consult Aamzon Kinesis development documentation to learn developing consumer applications of Kinesis Streams.

Check out Samples for how to build a system using the integration of ARTIK cloud services and Amazon Kinesis Streams.