Creating an AWS Greengrass V2 connection
The AWS IoT Greengrass connector publishes the messages of your devices to the MQTT broker of your local AWS IoT Greengrass V2 core device, and subscribes to a topic of this broker to receive the downlinks. It also registers your devices as things of your AWS IoT account.
The data follows this path: LoRaWAN® device → ThingPark Enterprise → ThingPark X IoT Flow connection → AWS IoT Greengrass V2 core device → your local applications or AWS IoT Core.
Before you create the connection, you need a Greengrass V2 core device installed and set up as described in How to Install AWS Greengrass V2 in 6 Steps.
AWS Greengrass V2 Overview
Why Use Greengrass V2 With ThingPark Enterprise
ThingPark Enterprise on-premise (OCP) together with a local AWS IoT Greengrass V2 node gives enterprises a dependable local infrastructure for their industrial IoT use cases. Everything runs locally, so critical data flows and services do not depend on any cloud service. You can still export the important data to cloud services for storage or further processing.

AWS IoT Greengrass V2 extends AWS services onto local devices, so that they can act locally on the data they ingest, while still taking advantage of the cloud.
ThingPark Enterprise OCP runs highly available LoRaWAN® private networks that aggregate the sensor data, and connects to the local AWS Greengrass V2 core instance with the built-in ThingPark X Greengrass connector.
With this combined solution:
- the LPWAN sensor network is entirely managed locally,
- the sensor data is fully decoded, aggregated and processed locally,
- the data can be synchronized to the cloud or delivered to local applications (running on the Greengrass V2 instance as Lambda functions or connected to it). Both cloud and local applications can send JSON commands, which ThingPark Enterprise encodes as needed and delivers to the devices over the LPWAN network.
Key Benefits
Executed locally, managed globally: with Greengrass V2 and ThingPark Enterprise OCP, your data does not go to a distant cloud, which saves time when milliseconds matter. Data is collected, processed and routed locally, in compliance with the strictest security policies. Greengrass core instances are still managed from the cloud, so that the AWS workloads are deployed and maintained the same way across multiple facilities, with the same security policies.
No cloud dependency: AWS Greengrass V2 keeps the service running with poor or no cloud connectivity. You can keep running local logic and actions based on LoRaWAN® sensor input during a loss of cloud connectivity, and buffer data until the internet connection is restored. With the similar local buffering of the LoRaWAN® gateways of ThingPark Enterprise, all critical sensor data is recovered after an infrastructure or local connectivity outage.
A dependable infrastructure: mission-critical applications require a fully redundant system, end to end. At radio level, macro-diversity provides it: two or more gateways give connectivity to each sensor. The ThingPark Enterprise network server can be deployed in HA mode, with or without geo-redundancy, and so can your Greengrass V2 server. Peering routes can be set up between local ThingPark Enterprise instances through ThingPark Exchange, so that devices that roam across corporate sites (or to a public network) keep a seamless service.
Optimal cloud service consumption: not all data is worth sending to the cloud, especially over high-cost or bandwidth-limited backhaul connections. AWS Greengrass V2 embeds local Lambda compute, local messaging and machine learning inference, to aggregate, transform or filter data according to your needs. ThingPark Enterprise decodes the payloads with the device codecs, so that the data reaches the Greengrass core instance in JSON format.
How to Install AWS Greengrass V2 in 6 Steps
This page gives an overview of the installation and configuration of a local AWS IoT Greengrass V2 instance. For more details, see the AWS reference documentation: AWS IoT Greengrass V2 tutorials.

- Step 1. Prepare IAM roles
- Step 2. GG Core Device installation
- Step 3. Components installation & setup
- Step 4. Create a bridge device
- Step 5. Connect with ThingPark: with UI or with API
- Step 6. End to end test
Step 1 - Prepare IAM Roles
Before you install a Greengrass V2 instance locally, get IAM credentials as described in Managing access keys for IAM users. All the operations are given in Step 1 of the AWS getting started guide.
Collect these two parameters, the Access key ID and the Secret access key of the connection:
"accessKeyId": "AKIAIOSFODNN7EXAMPLE",
"secretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
Step 2 - GG Core Device Installation
Set up your environment (Step 2 of the getting started guide), then install your Greengrass core device as described in Step 3 of the getting started guide.

Step 3 - Components Installation & Setup
Follow this tutorial: Tutorial: Interact with local IoT devices over MQTT.
Install these components on your local Greengrass V2 instance:
- aws.greengrass.clientdevices.Auth
- aws.greengrass.clientdevices.IPDetector
- aws.greengrass.clientdevices.mqtt.Moquette
- aws.greengrass.clientdevices.mqtt.Bridge (optional), only if you want to relay messages from your local Greengrass instance to AWS IoT Core.
The aws.greengrass.clientdevices.Auth component needs a configuration to allow the communication between the local Greengrass core and AWS IoT Core.
Here is the expected setup. Replace the thing name GGActilityBridge with your own value. The policy name can stay unchanged.
{
"deviceGroups": {
"formatVersion": "2021-03-05",
"definitions": {
"MyDeviceGroup": {
"selectionRule": "thingName: GGActilityBridge",
"policyName": "ActilityDevicePolicy"
}
},
"policies": {
"ActilityDevicePolicy": {
"AllowConnect": {
"statementDescription": "Allow client devices to connect.",
"operations": [
"mqtt:connect"
],
"resources": [
"*"
]
},
"AllowPublish": {
"statementDescription": "Allow client devices to publish to all topics.",
"operations": [
"mqtt:publish"
],
"resources": [
"*"
]
},
"AllowSubscribe": {
"statementDescription": "Allow client devices to subscribe to all topics.",
"operations": [
"mqtt:subscribe"
],
"resources": [
"*"
]
}
}
}
}
}
Configure the Bridge component if you want to relay your messages to AWS IoT Core.
Depending on your use case, choose an architecture. The communication between ThingPark Enterprise and the local Greengrass V2 core instance can use a single MQTT topic that aggregates the uplinks of all the devices ("bridge topic"), or a dedicated topic per device.
Bridge Topic Architecture (Recommended)
A bridge topic aggregates the uplinks of all devices, for processing by a Lambda function running on the local Greengrass V2 core instance. There, you create your own processing and filtering rules, and send only selected messages to AWS IoT Core. You fully control the traffic exchanged with the AWS cloud.

Your Bridge configuration looks like this (component aws.greengrass.clientdevices.mqtt.Bridge):
{
"mqttTopicMapping": {
"ThingParkToAwsIoTCoreMapping": {
"topic": "tpx/things/ActilityGreengrassBridge/uplink",
"source": "LocalMqtt",
"target": "IotCore"
}
}
}
In ThingPark Enterprise, the Published topic pattern (uplinkTopicPattern) of the Greengrass V2 connection is then similar to tpx/things/ActilityGreengrassBridge/uplink.
Keep this MQTT topic name for the creation of the connection, in Step 5.
Device Topic Architecture
Each device has its own MQTT topic. With this architecture, all your local devices communicate with AWS IoT Core in the cloud. If you already use AWS IoT Core, it is an easier migration path, but it is not optimal for a Greengrass V2 architecture, as you have no control over the traffic toward the cloud. You can move to the bridge topic architecture later.

Your Bridge configuration is similar to this (component aws.greengrass.clientdevices.mqtt.Bridge):
{
"mqttTopicMapping": {
"ThingParkToAwsIoTCoreMapping": {
"topic": "tpx/things/+/uplink",
"source": "LocalMqtt",
"target": "IotCore"
}
}
}
In ThingPark Enterprise, the Published topic pattern (uplinkTopicPattern) of the Greengrass V2 connection is then similar to tpx/things/{DevEUI}/uplink.
Keep this MQTT topic name for the creation of the connection, in Step 5.
Step 4 - Create a Greengrass "Thing" to Represent the ThingPark Connector
Greengrass V2 sees the ThingPark Enterprise connector as a client device. Create a Greengrass thing that represents the ThingPark connector instance, as described in Step 2 of the AWS Tutorial: Interact with local IoT devices over MQTT.
During this step, you create a thing policy, for example:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"iot:Publish",
"iot:Subscribe",
"iot:Connect",
"iot:Receive"
],
"Resource": [
"*"
]
},
{
"Effect": "Allow",
"Action": [
"greengrass:*"
],
"Resource": [
"*"
]
}
]
}
At the end of this step, collect:
- the public key file (also named certificate) of the thing,
- the private key file of the thing,
- the AWS CA certificate file (RSA 2048 Amazon Root CA 1),
- the certificate ARN of the thing (in the certificates of the thing).
Collecting Expected Information
Parameters required
| UI Field | Description |
|---|---|
| Name | Name of the connection. |
| Region | Region of the AWS IoT datacenter, for example eu-central-1. |
| Access key ID | ID of the access key collected in Step 1, 20 alphanumeric characters. |
| Secret access key | Secret access key collected in Step 1. |
| Amazon Root CA certificate | AWS CA certificate file (RSA 2048 Amazon Root CA 1) collected in Step 4. |
| GreenGrass Host Name | Host name or IP address of your local Greengrass core device, and the port of its MQTT broker, for example 192.0.2.20:8883. |
| GreenGrass Thing Name | Name of the thing that represents the ThingPark connector, created in Step 4, for example ActilityGreengrassBridge. |
| Device type | AWS IoT thing type associated with the devices processed by the connection. Default ActilityGGADType. |
| GGAD Certificate ID | Certificate ARN of the thing created in Step 4. |
| GGAD certificate | Certificate file (public key) of this thing. |
| GGAD private key | Private key file of this thing. |
| Published topic pattern | Topic where the connector publishes the uplinks, chosen in Step 3, for example tpx/things/ActilityGreengrassBridge/uplink. See Topic Pattern Expression. |
| Subscribed topic pattern | Topic where the connector receives the downlinks, for example tpx/things/ActilityGreengrassBridge/downlink. |
| Description | Optional description of the connection. |
Creating a Connection With UI
-
In ThingPark Enterprise, click Connections -> + Add Connection -> ThingPark X IoT Flow.

-
In ThingPark X IoT Flow, click AWS IoT Greengrass in the list of connectors.

-
Fill in the form:
- Name: a clear name for the connection, for example
My AWS IoT Greengrass Connection. - Region: the region of your AWS IoT account. If it is not in the list, type it and add it.
- Access key ID: the access key ID collected in Step 1.
- Secret access key: the secret access key collected in Step 1.
- Amazon Root CA certificate: click the attachment button to select the Amazon Root CA 1 file.
- GreenGrass Host Name: the host name or IP address of your Greengrass core device, and the port of its MQTT broker.
- GreenGrass Thing Name: the name of the thing that represents the connector.
- Device type: keep the default thing type or enter yours.
- GGAD Certificate ID: the certificate ARN of the thing.
- GGAD certificate: click the attachment button to select the certificate file of the thing.
- GGAD private key: click the attachment button to select the private key file of the thing.
- Published topic pattern: the uplink topic chosen in Step 3.
- Subscribed topic pattern: the downlink topic.
- Description: optional.

- Name: a clear name for the connection, for example
-
Click Create. A notification confirms that the connection has been created, and the connection details open.
-
In the connection details, check that the connection is OPENED (see Connection States).
Parameters marked with * are mandatory.
Creating a Connection With API
The connection can be created through the ThingPark REST API by using:
POST /connectionsto create a new Connection instancePUT /connections/{connectionId}to update a Connection instanceDELETE /connections/{connectionId}to delete a Connection instance
Example for creation of a new connection instance:
POST /connections
{
"connectorId": "actility-aws-iot-greengrass",
"name": "Greengrass Core connection",
"configuration": {
"region": "eu-central-1",
"accessKeyId": "AKIAIOSFODNN7EXAMPLE",
"secretAccessKey": "{YOUR-SECRET-ACCESS-KEY}",
"deviceType": "ActilityGGADType",
"uplinkTopicPattern": "tpx/things/ActilityGreengrassBridge/uplink",
"downlinkTopicPattern": "tpx/things/ActilityGreengrassBridge/downlink",
"ggHostName": "192.0.2.20:8883",
"ggadThingName": "ActilityGreengrassBridge",
"ggadCertificateId": "arn:aws:iot:eu-central-1:123456789012:cert/b129xxxx",
"ggadCertificate": "-----BEGIN CERTIFICATE-----MIIDWTCQAkGsAwIB-----END CERTIFICATE-----",
"ggadPrivateKey": "-----BEGIN RSA PRIVATE KEY-----MIIEsr-----END RSA PRIVATE KEY-----",
"awsRootCa": "-----BEGIN CERTIFICATE-----MIIDQTCAAimgAwIBGxxxx-----END CERTIFICATE-----"
}
}
The following table lists the properties applicable to a connection instance.
| Property | Description |
|---|---|
connectorId | Must be set to actility-aws-iot-greengrass. |
configuration/region | Region of the AWS IoT datacenter. |
configuration/accessKeyId | ID of the access key of your AWS account. |
configuration/secretAccessKey | Secret access key of your AWS account. |
configuration/awsRootCa | Content of the Amazon Root CA certificate. |
configuration/ggHostName | Host name or IP address of the Greengrass core device, and the port of its MQTT broker. |
configuration/ggadThingName | Name of the thing that represents the connector. |
configuration/ggadCertificateId | Certificate ARN of this thing. |
configuration/ggadCertificate | Content of the certificate of this thing. |
configuration/ggadPrivateKey | Content of the private key of this thing. |
configuration/deviceType | AWS IoT thing type associated with the devices of the connection. |
configuration/uplinkTopicPattern | Topic of the uplinks. It can contain topic pattern expressions. |
configuration/downlinkTopicPattern | Topic of the downlinks. |
We recommend these steps to generate the inline values of ggadPrivateKey and ggadCertificate:
ggadPrivateKey:
- Save the
.private.keyfile of your greengrass/certs folder on a Linux machine. - Run this command:
cat cb908e54bc.private.key | sed 's/$/\n/' | tr -d '\n' - Copy the result into the JSON payload.
ggadCertificate:
- Save the
.cert.pemfile of your greengrass/certs folder on a Linux machine. - Run this command:
cat cb783e54bc.cert.pem | tr -d '\n' - Copy the result into the JSON payload.
All properties are not present in this example. You can check the rest of these properties in the common parameters section.
Associating Devices With the Connection
In ThingPark Enterprise, open Devices, select a device, and add the connection to the Connections of the device. You can also select the connection when you create a device, or for many devices at once with a CSV file in Devices -> Bulk Operations.
Displaying Information to Know if It Worked
Test the end-to-end uplink data path:
- In the AWS IoT console, go to the Test section and subscribe to your topic (
tpx/things/ActilityGreengrassBridge/uplink).


- Check that the connection is OPENED, and wait for the devices associated with it to send uplinks.

ThingPark X IoT Flow creates the missing devices as things of your AWS IoT account, unless createDevices is set to false in the configuration of the connection. These things have the device type of the connection, and the same thing principal as the thing created in Step 4 to represent the connection on the Greengrass V2 node.
