Greengrass Component Deployment

SDK Development

Build custom Greengrass components using the /IOTCONNECT™ Python SDK. Learn the IPC communication model, telemetry publishing format, command handling, and how to create production-ready components that integrate with the /IOTCONNECT™ cloud.

SDK Architecture

The /IOTCONNECT™ Greengrass SDK uses an IPC (Inter-Process Communication) model. Your custom component communicates with the pre-installed SDK component via local pub / sub topics — typically does not communicate directly with the cloud; instead, it uses the SDK.

Communication Flow:

Telemetry (Device → Cloud): Your component publishes JSON to IPC topic iotc/rpt/d2gg/sub → SDK component picks it up → forwards to /IOTCONNECT™ via MQTT

Commands (Cloud → Device): /IOTCONNECT™ sends command via MQTT → SDK component receives → publishes to IPC topic iotc/cmd/gg2d/sub → your component subscribes and handles it

Why IPC?

Decoupling: Your component doesn’t need MQTT credentials or cloud connection logic

Security: Only the SDK component has cloud-facing credentials

Simplicity: Just publish JSON to a local topic — the SDK handles protocol, buffering, and retry

Multi-component: Multiple custom components can send telemetry simultaneously

Telemetry Format

Your component publishes telemetry as a JSON array to the IPC topic. Each message must include the device’s uniqueId, a timestamp, and data matching the template attributes.

Example: Publishing Telemetry

This Python example shows a minimal component that reads sensor data and publishes to the /IOTCONNECT™ IPC topic every 30 seconds:

Handling Commands

Commands are received from the cloud when a user clicks “Execute Command” in the portal. Your component subscribes to the command IPC topic and handles incoming messages.

Command flow:

User clicks Execute Command in the portal with parameter value

/IOTCONNECT™ sends command via MQTT to the device

SDK component receives and publishes to IPC topic iotc/cmd/gg2d/sub

Your component receives the command JSON and processes it

Your component sends an acknowledgement back via the ack IPC topic

Command JSON format received by your component:

{"ct": 0, "cmd": "set_interval", "ack": "guid", "v": 2.1, "cmdType": "0x01", "data": {"value": "10"}}

Key fields:

Field Description
cmd Command name (matches template command name)
ack GUID for acknowledgement — send this back to confirm execution
data.value The parameter value sent from the portal

Recipe Structure

The recipe defines how your component is installed and run on the device. Here’s an annotated example:

Development Tips

Local Development: Install Nucleus Classic on a PC / VM. Deploy the aws.greengrass.Cli public component. Use local-deploy.sh to instantly deploy components locally without uploading to the portal each iteration.

Logging: Use print() or Python’s logging module. Output goes to journalctl: journalctl -u greengrass* -f

Configuration: Pass config via recipe DefaultConfiguration. Access at runtime via {configuration:/KeyName} in the Run script arguments.

Error Handling: Always wrap IPC calls in try/except. A failed publish shouldn’t crash your component — log the error and retry.

Graceful Shutdown: Handle SIGTERM signal to clean up resources when the component is stopped or updated.

Dependencies: Install Python packages in the Install lifecycle step. Pin versions for reproducibility: pip install awsiotsdk==1.19.0

ⓘ RESOURCES

SDK Source: github.com/avnet-iotconnect/iotc-python-greengrass-sdk
Demo Components: github.com/avnet-iotconnect/iotc-python-greengrass-demos
Component Examples: github.com/avnet-iotconnect/iotc-python-greengrass-components

The SDK is MIT licensed — modify, build, and distribute freely.