AWS EveryCloud Example¶
In this tutorial we will see how to create an Elasticsearch instance on AWS and configure it as an external application to use with claimed devices in your Device Portal. Events from devices will be sent to Elasticsearch for indexing and we can use Kibana to create dashboards and visualized our data.
- AWS account with permission to launch services and create IAM roles
- Have an account on the Device Portal connected & claimed devices. See the device owner page for more info.
Setup AWS application¶
To simplify the setup of the required AWS services we have prepared an AWS CloudFormation template.
- Copy and save the CloudFormation Template 'api-lambda-es.yaml' on your computer
- Sign in to your AWS account at https://console.aws.amazon.com
- Go to the CloudFormation service page
Upload a template fileand upload
api-lambda-es.yamlfrom step 1
- Configure template parameters
- Give a cloudformation stack name, ex:
- Go to https://www.google.com/search?q=what+is+my+ip to get your current public IP and add it to
- Replace the
Tokenfield with random value and remember it as we will use it later.
- (Optional) Configure elasticsearch setup
- No need for custom stack options so can click
- We have to acknowledge that the template will create an IAM role (used to give Lambda permission to Elasticsearch) and then click
- AWS CloudFormation will create and configure our services, it will take ~15 minutes to complete.
- Once complete we can go to the
Outputstab to see the relevant URLs created
Connect External Application ¶
- In the Device Portal, we can click the "hamburger" menu button in the top left corner to access the application page.
- Once in the Device Portal's application page we click
CONNECT APPto configure our Elasticsearch application.
- We will use the following configuration
- Give an appropriate name, ex:
External HTTPSapplication type
- For HTTPS callback URL we can copy the
LambdaAPIURL from our CloudFormation
tokenas Authentication type
Token prefixempty, and input the token used to create the AWS Elasticsearch stack
CONNECT APPto finalize the setup
After adding an application we will see a popup with a token. This token can be used for external applications to interface with some of the available Device Portal API's such as list devices.
Our Elasticsearch instance does not use such functionality so we can just close this popup.
If there are devices connected and sending events to our Device Portal application we should now see a green-mark indicating that our Elasticsearch app has received and successfully acknowledged device events.
In application details, we can also see the last callback status.
Create Kibana visualization ¶
We can now create visualizations for our device events using Kibana. In the application of this example there are two devices connected,
device002. These two devices are sending a number to a resource called
temp. We will create a bar graph for this resource grouped by device identity.
- Go to the Kibana UI by clicking the
KibanaURL in the AWS CloudFormation
- We are then greeted by the Kibana setup page, here we will click
Explore on my own
- On the Kibana main page we can click
Connect to your Elasticsearch Index
- Indexes are automatically created when device events are successfully reaching our Elasticsearch. So if we have devices sending data we should see a
pdaas-yyy-mm-ddindex created. We will add a wildcard pattern for
- Next we need to select our timestamp field
@timestampand finally click
Create index pattern
- We can now see our index pattern and all available fields
- Next we can click the
Create a visualizationand select
averageand field to our
- Go to
Optionstab next to
Split color themeto
- We now have our stacked bar graph over
tempsplit by device
identitywith live data from our devices