How to Connect an Embedded System to AWS IoT Core with MQTT
Use MQTT on Amazon Web Services with a Hardware Device (ESP32) and use the IoT Data for further analysis on AWS itself
| Component | Qty | Notes |
|---|---|---|
| Raspberry Pi 4 Model B | 1 | — |
| Atym | 1 | — |
| Unknown | 1 | — |
Atym is a container orchestration platform that makes it easy to develop, deploy, secure, and manage applications on resource-constrained edge devices at scale. Built on WebAssembly (Wasm), Atym extends cloud-native principles to devices ranging from tiny microcontrollers with as little as 256KB of memory to full Linux systems like the Raspberry Pi.
Whether you're targeting MCU-based hardware running Zephyr RTOS or CPU-based devices running Linux, Atym provides a unified workflow: build your application once, push it to the Atym Hub, and deploy it to any supported device. The Atym Runtime handles execution, isolation, and hardware access, while the Atym Hub gives you a web console and CLI for remote management of individual devices or entire fleets.
The runtime is built on Ocre, an open-source project hosted by the Linux Foundation, ensuring you're working with transparent, community-driven technology rather than a proprietary black box.
In this guide, you will prepare a Raspberry Pi in headless mode, install and configure the Atym runtime service, set up a development environment for building Wasm containers, and deploy example code.
This guide assumes you are comfortable using the terminal and have basic familiarity with Raspberry Pi and Linux.Documentation references:
Atym provides a preconfigured development container that includes the full toolchain needed to build WebAssembly containers. Using the Dev Container is the recommended approach because it avoids manual installation of the WASI SDK and build tools on your host system.
Before continuing, make sure you have:
On your development machine, clone the Atym getting-started repository:
git clone --recursive https://github.com/atym-io/getting-started.gitcd getting-startedWhy --recursive? This repository includes the Atym SDK as a submodule, which provides the C API definitions needed to build Atym applications.
If you already cloned without submodules:
git submodule update --init --recursiveOpen the directory in VS Code:
code . Run the Dev Containers: Open Folder in Container... command from the Command Palette (Cmd + Shift + P on Mac, or Ctrl + Shift + P on Windows).
Select the folder containing the cloned repository.
The VS Code window will reload and create the container. This may take a few minutes the first time.
You can also run the toolchain container interactively:
cd getting-started/samplesdocker run --rm -it -v $(pwd):/home/atym ghcr.io/atym-io/atym-c-toolchain:latestAlternative: Install CLI Without Dev Container
If you're not using the Dev Container, you can install the Atym CLI directly on your development machine. Instructions for Linux, MacOS, and Windows can be found on in the Atym Quickstart Documentation.
Once the container is running, your environment includes:
wasi-sdk for compiling Wasm binariesiwasm for Wasm toolingYou can confirm everything is set up correctly by opening a terminal in VS Code running:
atym versionYou should see output similar to:
Atym CLIVersion: v1.0.3Then associate the CLI with your Atym account:
atym loginFrom this point on, all build commands in the guide should be run inside the Dev Container unless explicitly stated otherwise.
Run on your development machine:
atym add device --deviceName "my-rpi" --description "Raspberry Pi 4" --serialNumber "RPI4001"If successful, you'll receive credentials:
{ "deviceUUID": "67c1c350-cc1c-482d-bde9-875688ff9b23", "pskSecret": "IEAaeWHKhYs4fAScF5ApQ0C9eGcXu123", "tenantUUID": "2C9D9E73-702E-49DF-8181-F7B56849B864"}Save these values — you will need all of them to configure the runtime:
deviceUUID — unique identifier for this devicepskSecret — pre-shared key for secure communicationtenantUUID — your organization's tenant identifierYou can also retrieve your tenant ID with:
atym show configDownload from: https://www.raspberrypi.com/software/
1. Open Raspberry Pi Imager.
2. Choose OS → Raspberry Pi OS (64-bit) or Ubuntu Server (64-bit).
3. Select your SD card.
1. Open advanced settings (Ctrl+Shift+X or the gear icon).
2. Enable:
3. Set username/password, locale, and timezone.
4. Write the image.
Insert the SD card into the Pi and power it on.
SSH into your Pi:
ssh pi@raspberrypi.localIf mDNS is unavailable, find the IP via router or:
arp -aDownload and extract the Atym runtime for Raspberry Pi (aarch64):
The official Atym Quickstart Guide for Linux devices has the most up to date instructions.
wget https://atympublicshare.blob.core.windows.net/runtime/linux/latest/atym-runtime-debian-aarch64.tar.gztar -xzf atym-runtime-debian-aarch64.tar.gzcd atym-runtimeatym config set device/id deviceUUID@tenantID atym config set device/psk pskSecret atym config set server/endpoint coapgw.prod.atym.io atym runtime config set server/port 5684Start and enable:
./bin/atym-runtimeWhen your device successfully connects, you'll see:
Client connected successfullyThe getting-started repository includes a hello-world sample written in C. In your Dev Container terminal, navigate to it:
cd samples/hello-worldmkdir build && cd buildcmake ..makeThis creates hello-world.wasm, the WebAssembly module that will be packaged into an Atym container.
Return to the sample root and build the container:
cd ..atym build -vThe atym build command reads the build.yaml file in the project directory to package your Wasm binary into an Atym container. You should see a new .atym directory created in your home directory containing the container.
atym push hello-worldatym run hello-world -n deviceNameThe first command pushes your container to the Atym Hub (which works like a Docker registry. Atym containers are OCI-compliant). The second deploys it to your device.
Your device name (
my-rpi) was set when you registered the device. You can find it with:
atym list devices
You should see a success message in your console similar to:
atym:~$ Client connected. _ _________ ___ ______________ ______ ____ __ | | /| / / __/ _ )/ _ | / __/ __/ __/ |/ / _ )/ /\ \/ / | |/ |/ / _// _ / __ |_\ \_\ \/ _// /|_/ / _ / /__\ / |__/|__/___/____/_/ |_/___/___/___/_/ /_/____/____//_/ powered by Atym Update v4After running atym run, the Atym Hub will deploy your container to the device. You can verify the container is running:
atym list containers -n my-rpiThis should show your hello-world container in the list.
You can verify the container is running on your device:
atym list containers -n my-rpiThis should show your hello-world container in the list with a running status.
You've successfully set up a Raspberry Pi with the Atym runtime and deployed your first Wasm container. From here you can:
samples/ directory (GPIO, sensors, timers, messaging)coapgw.prod.atym.io5684UUID@TENANT_IDatym list devicesatym show device -n my-rpiatym clear -n my-rpiatym list containers -n my-rpiatym push name:tagatym run container image -n deviceName