RAK7249 LoRaWAN Network Server Guide
AWS IoT Core for LoRaWAN
Execute the following steps to set up your AWS account and permissions:
Set up Roles and Policies in IAM
Add an IAM Role for CUPS Server
Adding an IAM role will allow the Configuration and Update Server (CUPS) to handle the wireless gateway credentials.
This procedure needs to be done only once, but must be performed before a LoRaWAN gateway tries to connect with AWS IoT Core for LoRaWAN.
-
Go to the IAM Roles page on the IAM console.
-
Choose Create role.
-
On the Create Role page, choose Another AWS account.
-
Enter your Account ID, then select Next: Permissions.
-
In the search box next to the Filter Policies, type AWSIoTWirelessGatewayCertManager.
-
If the search results show the policy named AWSIoTWirelessGatewayCertManager, select it by clicking the checkbox.
-
If the policy does not exist, create one.
- Go to the IAM console.
- Choose Policies from the navigation pane.
- Choose Create Policy, then select the JSON tab to open the policy editor.
- Replace the existing template with trust policy document.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "IoTWirelessGatewayCertManager",
"Effect": "Allow",
"Action": [
"iot:CreateKeysAndCertificate",
"iot:DescribeCertificate",
"iot:ListCertificates",
"iot:RegisterCertificate"
],
"Resource": "*"
}
]
}- Choose Review Policy to open the Review Page.
- For the Name, type AWSIoTWirelessGatewayCertManager.
NOTEYou must enter the name as AWSIoTWirelessGatewayCertManager and must not use a different name. This is for consistency with future releases.
- For the Description, enter a description of your choice.
- Then choose Create policy. You will see a confirmation message showing the policy has been created.
-
-
Choose Next: Tags, then Next: Review.
-
In Role name, enter IoTWirelessGatewayCertManagerRole, and then choose to Create role.
You must not use a different name. This is for consistency with future releases.
- In the confirmation message, choose IoTWirelessGatewayCertManagerRole to edit the new role.
- In the Summary, choose the Trust relationships tab, and then choose Edit trust relationship.
- In the Policy Document, change the Principal property to represent the IoT Wireless service:
"Principal": {
"Service": "iotwireless.amazonaws.com"
},
- After changing the Principal property, the complete policy document should look like the following:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "iotwireless.amazonaws.com"
},
"Action": "sts:AssumeRole",
"Condition": {}
}
]
}
- Choose Update Trust Policy to save your changes and exit. At this point, you have created the IoTWirelessGatewayCertManagerRole and you won't need to do this again.
The examples in this document are intended only for dev environments. All devices in your fleet must have credentials with privileges that authorize only intended actions on specific resources. The specific permission policies can vary for your use case. Identify the permission policies that best meet your business and security requirements. For more information, refer to Example Policies and Security Best Practices
Add IAM Role for Destination to AWS IoT Core for LoRaWAN
Creating a PolicyCreating a policy gives the role permissions to describe the IoT endpoint and publish messages to AWS IoT.
- Go to the IAM console.
- Choose Policies from the navigation pane.
- Choose Create Policy, then choose the JSON tab to open the policy editor. Replace the existing template with this trust policy document:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action":
[
"iot:DescribeEndpoint",
"iot:Publish"
],
"Resource": "*"
}
]
}
- Choose Review Policy to open the Review page.
- For Name, enter a name of your choice.
- For Description, enter a description of your choice.
- Choose Create policy. You will see a confirmation message indicating that the policy has been created.
- In the IAM console, choose Roles from the navigation pane to open the Roles page.
- Choose Create Role.
- In Select type of trusted entity, choose Another AWS account.
- In Account ID, enter your AWS account ID, and then choose Next: Permissions.
- Search for the IAM policy you just created by entering the policy name in the search bar.
- In the search results, select the checkbox corresponding to the policy.
- Choose Next: Tags.
- Choose Next: Review to open the Review page.
- For Role name, enter an appropriate name of your choice.
- For Description, enter a description of your choice.
- Choose Create role. You will see a confirmation message indicating that your role has been created.
Update your role's trust relationship to grant AWS IoT Core for LoRaWAN permission to assume this IAM role when delivering messages from devices to your account.
- In the IAM console, choose Roles from the navigation pane to open the Roles page.
- Enter the name of the role you created earlier in the search window, and click on the role name in the search results. This opens up the Summary page.
- Choose the Trust relationships table to navigate to the Trust relationships page.
- Choose Edit trust relationship. The principal AWS role in your trust policy document defaults to root and must be changed. Replace the existing policy with this:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Service": "iotwireless.amazonaws.com"
},
"Action": "sts:AssumeRole",
"Condition": {}
}
]
}
- Choose Update Trust Policy. Under Trusted entities, you will see: The identity provider(s) iotwireless.amazonaws.com.
Add the Gateway to AWS IoT
RequirementsTo complete setting up your gateway, you need the following:
- LoRaWAN region. For example, if the gateway is deployed in a US region, the gateway must support LoRaWAN region US915.
- Gateway LNS-protocols. Currently, the LoRa Basics Station protocol is supported.
- Gateway ID (GatewayEUI) or serial number. This is used to establish the connection between the LNS and the gateway. Consult the documentation for your gateway to locate this value.
- Add minimum software versions required, including Basics Station 2.0.5.
Add the LoRaWAN Gateway
To register the Gateway with AWS IoT Core for LoRaWAN, execute these steps:
- Go to the AWS IoT console.
- Select Wireless connectivity in the navigation panel on the left.
- Choose Intro, and then choose Get started. This step is needed to pre-populate the default profiles.
- Under Add LoRaWAN gateways and wireless devices, choose Add gateway.
- In the Add gateway section, fill in the GatewayEUI and Frequency band (RF Region) fields.
- Enter a descriptive name in the Name – optional field. It is recommended that you use the GatewayEUI as the name.
- Choose Add gateway.
- On the Configure your Gateway page, find the section titled Gateway certificate.
- Select Create certificate.
- Once the Certificate created and associated with your gateway message is shown, select Download certificates to download the certificate (xxxxx.cert.pem) and private key (xxxxxx.private.key).
- In the section Provisioning credentials, choose Download server trust certificates to download the CUPS (cups.trust) and LNS (lns.trust) server trust certificates.
- Copy the CUPS and LNS endpoints and save them for use while configuring the gateway.
- Choose Submit to add the gateway.