Skip to content

Commit d4cbf67

Browse files
committed
Documentation layout & resources update (Initial)
1 parent 3832a35 commit d4cbf67

File tree

7 files changed

+96
-2
lines changed

7 files changed

+96
-2
lines changed
95.3 KB
Loading
55.5 KB
Loading
7.82 KB
Loading
22.7 KB
Loading
26.6 KB
Loading
14.9 KB
Loading

content/arduino-cloud/09.business/02.aws-s3-exporter/content.md

Lines changed: 96 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,105 @@ author: 'Taddy Ho Chung'
1111
software:
1212
- iot-cloud
1313
- aws-lambda
14+
- go
1415
---
1516

1617
## Overview
1718

18-
This project provides a method to extract time series data from the Arduino Cloud and publish it to an S3 destination bucket. Data is extracted at a specified resolution through a scheduled Lambda function. The samples are stored in CSV files and uploaded to S3.
19+
The **Arduino AWS S3 CSV Exporter** is designed to extract time series data from **Arduino Cloud** and publish it to an **AWS S3** bucket. The data extraction is managed by a scheduled AWS Lambda function that operates at configurable intervals, with samples aggregated based on the user’s preference. Data is stored in CSV format and uploaded to S3, providing a structured way to manage and store data.
1920

20-
By default, data extraction occurs every hour (this interval is configurable), with samples aggregated at a 5-minute resolution (also configurable). Aggregation is performed as an average over the aggregation period. Non-numeric values, such as strings, are sampled based on the defined resolution.
21+
## Goals
2122

23+
* Understand the functionality of the Arduino AWS S3 CSV Exporter
24+
* Learn how to configure and deploy the Lambda function for data extraction
25+
* Set up filtering and resolution options for optimized data aggregation
26+
* Get started with configuring the exporter using CloudFormation
27+
28+
## Required Software
29+
30+
* [Arduino Cloud](https://cloud.arduino.cc/). If you do not have an account, you can create one for free inside [cloud.arduino.cc](https://cloud.arduino.cc/home/?get-started=true).
31+
* [AWS CLI](https://aws.amazon.com/cli/)
32+
* [Go Programming Language](https://go.dev/) (version 1.22 or higher)
33+
34+
## Deployment Using CloudFormation Template
35+
36+
The exporter setup involves deploying resources using a CloudFormation template. Ensure your AWS account has permissions for:
37+
38+
* CloudFormation stack creation (policy: `AWSCloudFormationFullAccess`)
39+
* S3 bucket management (policy: `AmazonS3FullAccess`)
40+
* IAM role creation (policy: `IAMFullAccess`)
41+
* Lambda function deployment (policy: `AWSLambda_FullAccess`)
42+
* EventBridge rule configuration (policy: `AmazonEventBridgeFullAccess`)
43+
* Parameter management in SSM (policy: `AmazonSSMFullAccess`)
44+
45+
### Setting Up
46+
47+
Get the [Lambda binaries](https://github.com/arduino/aws-s3-integration/releases) (`.zip` file) and the [CloudFormation template](https://github.com/arduino/aws-s3-integration/releases) (`.yaml` file).
48+
49+
Upload the binaries and the template to an accessible S3 bucket. Note the object URL for use in the stack creation process.
50+
51+
Use the CloudFormation console to create a new stack, entering the required parameters:
52+
53+
- **Mandatory:** Arduino API key and secret, the S3 bucket for code, and the destination S3 bucket.
54+
- **Optional:** Tag filter, organization ID, and data resolution settings.
55+
56+
## Configuration Parameters
57+
58+
Below are the supported configuration parameters that are editable in the AWS Parameter Store. These parameters are pre-filled during stack creation but can be modified later:
59+
60+
| **Parameter** | **Description** |
61+
|----------------------------------------------------------------|-------------------------------------------|
62+
| `/arduino/s3-exporter/{stack-name}/iot/api-key` | IoT API key |
63+
| `/arduino/s3-exporter/{stack-name}/iot/api-secret` | IoT API secret |
64+
| `/arduino/s3-exporter/{stack-name}/iot/org-id` | Organization ID (Optional) |
65+
| `/arduino/s3-exporter/{stack-name}/iot/filter/tags` | Tag filter (e.g., `tag=value`) (Optional) |
66+
| `/arduino/s3-exporter/{stack-name}/iot/samples-resolution` | Aggregation resolution (Optional) |
67+
| `/arduino/s3-exporter/{stack-name}/iot/scheduling` | Execution schedule |
68+
| `/arduino/s3-exporter/{stack-name}/iot/align_with_time_window` | Align data extraction with time windows |
69+
| `/arduino/s3-exporter/{stack-name}/destination-bucket` | S3 destination bucket |
70+
| `/arduino/s3-exporter/{stack-name}/enable_compression` | Enable gzip compression for CSV uploads |
71+
72+
## Tag Filtering
73+
74+
You can filter devices in the Arduino Cloud using tags. Add tags in the Arduino Cloud UI under the Metadata section of each device.
75+
76+
During CloudFormation stack creation, configure tag filters using:
77+
78+
```bash
79+
/arduino/s3-exporter/{stack-name}/iot/filter/tags
80+
```
81+
82+
## CSV File Structure
83+
84+
The exported CSV files have the following format:
85+
86+
```bash
87+
timestamp,thing_id,thing_name,property_id,property_name,property_type,value,aggregation_statistic
88+
```
89+
90+
Files are organized by date, and the naming follows a structured format for easy identification:
91+
92+
```bash
93+
<bucket>:2024-09-04/2024-09-04-10-00.csv
94+
<bucket>:2024-09-04/2024-09-04-11-00.csv
95+
```
96+
97+
## Building the Code
98+
99+
Ensure [**Go (version 1.22)**](https://go.dev/) is installed to build the exporter locally. The core code can be built using:
100+
101+
```bash
102+
./compile-lambda.sh
103+
```
104+
105+
This creates a **`arduino-s3-integration-lambda.zip`** file. Alternatively, run:
106+
107+
```bash
108+
task go:build
109+
```
110+
111+
## Additional Documentation
112+
113+
* [Arduino Cloud Documentation](https://docs.arduino.cc/cloud/iot-cloud)
114+
* [AWS Lambda Documentation](https://docs.aws.amazon.com/lambda/)
115+
* [Go Programming Language Documentation](https://go.dev/doc/)

0 commit comments

Comments
 (0)