Memfault integration for AWS

The nRF Connect SDK provides integration with Memfault.

By default, Memfault data is sent using HTTPS. Using MQTT is possible and preferred, because it reduces power consumption. The nRF Asset Tracker Memfault integration for AWS IoT, or the nRF Asset Tracker Memfault integration for Azure IoT Hub provide the necessary cloud resources to send Memfault data using the device’s established MQTT cloud connection. Core dumps, which are collected when the application crashes, are still sent to Memfault using HTTPS. This only happens once after a reboot and it allows you to identify issues with the MQTT connection.

You can use the integration standalone without an existing instance of nRF Asset Tracker for AWS.

Prerequisites

Before you start setting up the Memfault integration for AWS, make sure that you fulfill the following prerequisites:

Clone the project and install the dependencies

To clone the nRF Asset Tracker Memfault integration for AWS IoT project and install the dependencies, use the following commands:

git clone --branch saga --single-branch \
  https://github.com/NordicSemiconductor/asset-tracker-cloud-memfault-aws-js memfault-aws

cd memfault-aws

# Install the dependencies
npm ci

Configure Memfault settings

You can retrieve the project settings from the settings page of the Memfault dashboard of your organization.

aws ssm put-parameter --type String --name /${STACK_NAME:-nrf-memfault}/thirdParty/memfault/projectKey --value <your memfault project key>
aws ssm put-parameter --type String --name /${STACK_NAME:-nrf-memfault}/thirdParty/memfault/organization --value <your organization slug>
aws ssm put-parameter --type String --name /${STACK_NAME:-nrf-memfault}/thirdParty/memfault/project --value <your project slug>

Administrators can access and manage the organization authorization token at Admin > Organization Auth Tokens in the Memfault UI.

aws ssm put-parameter --type String --name /${STACK_NAME:-nrf-memfault}/thirdParty/memfault/authToken --value <your auth token>

Configure stack settings

You can configure the topic that devices use to publish Memfault chunks through the CDK context variable memfaultTopic. The topic defaults to +/memfault/#.

Deploy the solution to your AWS account

To deploy the Memfault integration to your AWS account, run the following command:

npx cdk deploy

After a successful deployment, make sure that your devices are allowed to publish to the configured MQTT topic (<deviceId>/memfault) by default. If you are using nRF Asset Tracker for AWS, this is already the case. Otherwise, refer to the AWS IoT Core Policies on how to configure permissions.

Once devices start publishing Memfault heartbeats and core dumps, they appear in your Memfault dashboard.