Amazon Parquet data lake

AWS S3 Lambda 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

Below requires a paid tier AWS account[1] and an S3 bucket[2].

Note

Ensure you test the MF4 decoders with your log files & DBC files locally before proceeding.


1: Upload files to input bucket

  1. Upload your prefixed DBC files (e.g. can1-xyz.dbc) to your bucket root via the S3 console[3]

  2. 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

  1. Open AWS CloudFormation and ensure you are in the same region as your input bucket

  2. Select the stack you used to create your S3 bucket (default name canedge-stack)[5]

  3. Click ‘Stack actions/Create change set for current stack’

  4. 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
    
  5. Enter a ‘UniqueID’ (e.g. datalake05)[7]

  6. Enter a valid email for notifications on Lambda errors/events[8]

  7. Click ‘Acknowledge’, ‘Submit’, wait ~1 min and click the upper-right refresh

  8. 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

  1. Upload a test MDF file from your CANedge into your input bucket via the S3 console

  2. 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

  1. Verify that your S3 output bucket contains Parquet files

  2. Open AWS Glue Triggers in a new tab

  3. Select the <uniqueid>-map-tables-on-demand trigger and click ‘Action/Start trigger’

  4. 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 name

  • UniqueID: Suffix for resource names, max 10 chars (default datalake01)

  • NotificationEmail: Email for Lambda error/event alerts

Resources

Name

Type

Purpose

<input-bucket>

S3::Bucket

Log files, DBC files and scripts (kept on stack delete)

<input-bucket>-parquet

S3::Bucket

The Parquet data lake

<input-bucket>-parquet-query-results

S3::Bucket

Athena query results

mdf-to-parquet-lambda-function-<uniqueid>

Lambda::Function

Decodes each new log file to Parquet (python3.12, 1024 MB, 120 s)

S3InvokePermission

Lambda::Permission

Lets the input bucket invoke the Lambda

mdf-to-parquet-lambda-error-alarm-<uniqueid>

CloudWatch::Alarm

Alarm on Lambda errors (via error topic)

ErrorSnsSubscription

SNS::Subscription

Emails error alarms

EventSnsSubscription

SNS::Subscription

Emails detected events

mdf-to-parquet-lambda-error-sns-<uniqueid>

SNS::Topic

Lambda error alarms

mdf-to-parquet-lambda-event-sns-<uniqueid>

SNS::Topic

Detected events (e.g. event alerts)

dbparquet<uniqueid>

Glue::Database

One table per device/message

<uniqueid>-process-aggregation

Glue::Job

Creates trip summary tables (2 x G.1X, 60 min)

<uniqueid>-process-backlog

Glue::Job

Processes a backlog of log files (2 x G.1X, 180 min)

<uniqueid>-map-tables

Glue::Job

Maps the output bucket to tables (2 x G.1X, 120 min)

<uniqueid>-process-aggregation-on-demand

Glue::Trigger

Runs trip summaries manually

<uniqueid>-process-aggregation-scheduled

Glue::Trigger

Daily trip summaries (inactive by default)

<uniqueid>-process-backlog-on-demand

Glue::Trigger

Runs backlog processing manually

<uniqueid>-map-tables-on-demand

Glue::Trigger

Runs table mapping manually

<uniqueid>-map-tables-scheduled

Glue::Trigger

Daily table mapping (inactive by default)

athenaworkgroup-<uniqueid>

Athena::WorkGroup

SQL queries on the data lake (e.g. Grafana)

AmazonS3FullAccessBucketKeys

IAM::AccessKey

Keys of the device user (outputs C06/C08)

AthenaAccessKey

IAM::AccessKey

Keys of the Athena user (outputs A01/A02)

S3LimitedAccessUserAccessKey

IAM::AccessKey

Keys of the above user (outputs A07/A08)

ProgrammaticAccessManagedPolicy

IAM::ManagedPolicy

Root JSON and DBC deletes (DBC also in one folder), Glue job runs, logs

S3LimitedAccessManagedPolicy

IAM::ManagedPolicy

Read/write input and output buckets, SNS

FullAccessToSpecificBucket

IAM::Policy

Full access to the input bucket

AthenaAccessPolicy-<uniqueid>

IAM::Policy

Athena permissions (Athena + programmatic users)

AWSGlueServiceRoleDataLake-<uniqueid>

IAM::Role

Table mapping job: Read input, write output

GlueDataProcessorRole-<uniqueid>

IAM::Role

Backlog and trip summary jobs

LambdaExecutionRole

IAM::Role

Lambda: Read input, write output, publish SNS

AmazonS3FullAccessBucketUser

IAM::User

Device uploads to the input bucket (kept on stack delete)

AthenaAccessUser-<uniqueid>

IAM::User

Athena clients such as Grafana

S3LimitedAccessUser-<uniqueid>

IAM::User

Programmatic access (scripts, AI agents)

Outputs

  • A01 Athena: Access Key ID (e.g. for Grafana-Athena)

  • A02 Athena: Secret Access Key

  • A03 Athena: Default Region

  • A04 Athena: Data Source: AwsDataCatalog

  • A05 Athena: Database: dbparquet<uniqueid>

  • A06 Athena: Workgroup: athenaworkgroup-<uniqueid>

  • A07 Programmatic access (e.g. AI agents): Access Key ID

  • A08 Programmatic access: Secret Access Key for A07

  • A09 Output S3 bucket name (Parquet data lake)

  • A10 Lambda events SNS topic ARN

  • C01 Device S3 config: Endpoint

  • C02 Device S3 config: Port: 80

  • C03 Device S3 config: Bucket name (input bucket)

  • C04 Device S3 config: Region

  • C05 Device S3 config: Request style: Virtual hosted-style

  • C06 Device S3 config: AccessKey (full access to input bucket)

  • C07 Device S3 config: SecretKey format: Plain

  • C08 Device S3 config: SecretKey