Amazon Parquet data lake
Here we explain how to deploy an Amazon Parquet data lake with automation and an interface.
This can e.g. be used in Grafana-Athena dashboards or Python/MATLAB scripts.
Overview
This guide lets you set up an automated data pre-processing workflow, including:
An ‘input bucket’ (for MDF/DBC files) and ‘output bucket’ (for Parquet files)
A ‘Lambda function’ (DBC decodes new MDF files and outputs them as Parquet files)
An ‘Athena’ SQL interface for querying the data lake (e.g. from Grafana)
Three ‘support Glue jobs’ (map data lake, process MDF backlogs, summarize trips)
Note
Ensure you test the MF4 decoders with your log files & DBC files locally before proceeding.
1: Upload files to input bucket
Upload your prefixed DBC files (e.g.
can1-xyz.dbc) to your bucket root via the S3 console[3]Upload below 4 files[4] (zip file and Python scripts) to your bucket root
Lambda zip | Mapping script | Backlog script | Aggregation script
2: Deploy integration
Open AWS CloudFormation and ensure you are in the same region as your input bucket
Select the stack you used to create your S3 bucket (default name
canedge-stack)[5]Click ‘Stack actions/Create change set for current stack’
Click ‘Replace current template’ and enter below:
https://css-electronics-resources.s3.eu-central-1.amazonaws.com/stacks/data-lake-v4.5.0-vG.6.0.json
Enter a ‘UniqueID’ (e.g.
datalake05)[7]Enter a valid email for notifications on Lambda errors/events[8]
Click ‘Acknowledge’, ‘Submit’, wait ~1 min and click the upper-right refresh
Click ‘Execute change set’ (and click it again in the popup), then wait ~1 min[6]
Note
If the deployment fails, double check that you uploaded the zip/scripts to your S3 input bucket
Note
If you later need to update the integration with a new revision, see this guide
3: Test your cloud function
Upload a test MDF file from your CANedge into your input bucket via the S3 console
Verify that the decoded Parquet files are created in your output bucket[9]
Your data lake will now get auto-filled when new MDF files are uploaded to the input bucket.
Note
If you are not seeing the expected results, review the Lambda CloudWatch logs
4: Map your Parquet data lake to tables
Verify that your S3 output bucket contains Parquet files
Open AWS Glue Triggers in a new tab
Select the
<uniqueid>-map-tables-on-demandtrigger and click ‘Action/Start trigger’Open the trigger target Glue job, click ‘Runs’ and verify that it succeeds[11]
Note
Glue adds ‘meta data’ about your S3 output bucket. If new devices/messages are added to your Parquet data lake, the Glue job should be triggered again (manually or by schedule)[10]
You can now use Athena as a data source in e.g. Grafana-Athena dashboards. See also the advanced topics to learn about backlog processing, event detection, trip summaries and more.
Technical
Advanced: The AWS resources created by the stack.
Deployed resources
Template data-lake-v4.5.0-vG.6.0.json (<...> are stack parameters).
Parameters
InputS3BucketName: Your input bucket nameUniqueID: Suffix for resource names, max 10 chars (defaultdatalake01)NotificationEmail: Email for Lambda error/event alerts
Resources
Name |
Type |
Purpose |
|---|---|---|
|
S3::Bucket |
Log files, DBC files and scripts (kept on stack delete) |
|
S3::Bucket |
The Parquet data lake |
|
S3::Bucket |
Athena query results |
|
Lambda::Function |
Decodes each new log file to Parquet (python3.12, 1024 MB, 120 s) |
|
Lambda::Permission |
Lets the input bucket invoke the Lambda |
|
CloudWatch::Alarm |
Alarm on Lambda errors (via error topic) |
|
SNS::Subscription |
Emails error alarms |
|
SNS::Subscription |
Emails detected events |
|
SNS::Topic |
Lambda error alarms |
|
SNS::Topic |
Detected events (e.g. event alerts) |
|
Glue::Database |
One table per device/message |
|
Glue::Job |
Creates trip summary tables (2 x G.1X, 60 min) |
|
Glue::Job |
Processes a backlog of log files (2 x G.1X, 180 min) |
|
Glue::Job |
Maps the output bucket to tables (2 x G.1X, 120 min) |
|
Glue::Trigger |
Runs trip summaries manually |
|
Glue::Trigger |
Daily trip summaries (inactive by default) |
|
Glue::Trigger |
Runs backlog processing manually |
|
Glue::Trigger |
Runs table mapping manually |
|
Glue::Trigger |
Daily table mapping (inactive by default) |
|
Athena::WorkGroup |
SQL queries on the data lake (e.g. Grafana) |
|
IAM::AccessKey |
Keys of the device user (outputs C06/C08) |
|
IAM::AccessKey |
Keys of the Athena user (outputs A01/A02) |
|
IAM::AccessKey |
Keys of the above user (outputs A07/A08) |
|
IAM::ManagedPolicy |
Root JSON and DBC deletes (DBC also in one folder), Glue job runs, logs |
|
IAM::ManagedPolicy |
Read/write input and output buckets, SNS |
|
IAM::Policy |
Full access to the input bucket |
|
IAM::Policy |
Athena permissions (Athena + programmatic users) |
|
IAM::Role |
Table mapping job: Read input, write output |
|
IAM::Role |
Backlog and trip summary jobs |
|
IAM::Role |
Lambda: Read input, write output, publish SNS |
|
IAM::User |
Device uploads to the input bucket (kept on stack delete) |
|
IAM::User |
Athena clients such as Grafana |
|
IAM::User |
Programmatic access (scripts, AI agents) |
Outputs
A01Athena: Access Key ID (e.g. for Grafana-Athena)A02Athena: Secret Access KeyA03Athena: Default RegionA04Athena: Data Source:AwsDataCatalogA05Athena: Database:dbparquet<uniqueid>A06Athena: Workgroup:athenaworkgroup-<uniqueid>A07Programmatic access (e.g. AI agents): Access Key IDA08Programmatic access: Secret Access Key for A07A09Output S3 bucket name (Parquet data lake)A10Lambda events SNS topic ARNC01Device S3 config: EndpointC02Device S3 config: Port:80C03Device S3 config: Bucket name (input bucket)C04Device S3 config: RegionC05Device S3 config: Request style:Virtual hosted-styleC06Device S3 config: AccessKey (full access to input bucket)C07Device S3 config: SecretKey format:PlainC08Device S3 config: SecretKey